The website I'm working on has a search function which displays the results with matches for the search term in bold. This effect is achieved with a simple snippet:
Code: Select all
$description = str_replace($q, "<strong>$q</strong>", $description);Code: Select all
<a href="http://www.<strong>searchterm</strong>.com/">some hyperlinked text</a>Here are lines 40 and 41 of the new code:Warning: Unknown modifier ']' in /food/bar/search3.php on line 41
Code: Select all
$needle = "<a[^>]*>.*(".preg_quote($q)."|".preg_quote($q_uc).").*</a>" ;
if(!preg_match($needle, $description)) { /*some stuff*/ }For example, I'd like the following to work:
Code: Select all
I like <strong>coffee</strong>. Visit <a href="http://www.coffee.com/">www.<strong>coffee</strong>.com</a>.Can anyone help with this? I especially need help with the unknown modifier warning; I might be able to figure out the rest on my own, though some help there would be appreciated as well.
Thanks,