I want a regex code , to replace all \"foo\" strings to \"bar\" , between the html tags pre>< /pre>
here is an example :
< html> < p>
$string = '< html> < p> blah blah blah foo try foo< /p> < pre> foo try foo word foofoo < /pre> < /html>'; $string = preg_replace('/foo(?=(?:.(?!< pre>))*< \/pre>)/Um', 'boo', $string); echo $string;