highlighting search terms

Posted on 16th Feb 2014 by admin

well, I started this in the regular PHP section, but it no longer fits there. Suffice it to say, I'm trying to take individual search terms that are being $_POSTed and highlighting them in the search results.

The Original Post talked about using str_replace to handle this. New problem, though, when the same search terms show up inside a HTML tag (like <img src="search_term">).

I'm trying "/b(?!<.+?>)search_termb/" -- but it's still finding "search_term" inside <img src="search_term">.

Other forums