I'm creating a simple search for my application.
I'm using PHP regular expression replacement (preg_replace) to look for a search term (case insensitive) and add tags around the search term.
preg_replace('/'.$query.'/i', '$0', $content);
Now I'm not the greatest with regular expressions. So what would I add to the regular expression to not replace search terms that are in a href
of an anchor tag?
That way if someone searched "info" it wouldn't change a link to "http://something.com/this_info
/index.html"