I would like to replace all words starting with 3ABC with an link including the found word. For example:
teststring 3ABCJOEDKLSZ2 teststring hello test
Output would be:
test string <a href='https://google.com/search/3ABCJOEDKLSZ2'>3ABCJOEDKLSZ2</a> teststring hello test
The substring I am looking for is always starting with 3ABC everything after that is dynamic.
preg_replace_callback3ABC\S+or3ABC[a-zA-Z\D]+I think would do it... or if3abcalso is valid make the+a*. Hard to tell where yourpreg_replacewent wrong without the code