php - Replace all matches within the tag
There is the following line:
$str = '<div class="hello"> Hello world < hello world?! </div>';
Need to find all the matches within the tag, while avoiding a match attribute values. Try something like:
$pattern = '/(.*)(hello)(.*)(?=<\/)/ui'; $replacement = '$1<span class="page_speed_748935785">$2</span>$3';
but yet there is only one "hello". What to do?