Organizational Research By

Surprising Reserch Topic

ignore html tags in preg replace

ignore html tags in preg replace  using -'php,html,preg-replace'

How do I ignore html tags in this preg_replace.
I have a foreach function for a search, so if someone searches for "apple span" the preg_replace also applies a span to the span and the html breaks:

preg_replace("/($keyword)/i","<span class=\"search_hightlight\">$1</span>",$str);

Thanks in advance!

asked Sep 14, 2015 by BennettSage
0 votes

Related Hot Questions

1 Answer

0 votes
answered Sep 14, 2015 by PhiTYG