I want the regex to use in preg_replace() to replace text only inside a tag (between "<" and ">"), without affect the text out of angle brackets limit. Like this example:
$html = '<div class="REPLACE_ME" id="my_id">this REPLACE_ME cannot be replaced</div>';
$html = preg_replace('/\bREPLACE_ME\b/', 'REPLACED', $html);
then, the result expected in $html variable must be like this:
<div class="REPLACED" id="my_id">this REPLACE_ME cannot be replaced</div>
The regex cannot be around the quotes, because I have other variants like:
<REPLACE_ME>this REPLACE_ME cannot be replaced</REPLACE_ME>
<div REPLACE_ME="my_attribute">this REPLACE_ME cannot be replaced</div>