I need to find and replace all text matches in a case insensitive way, unless the text is within an anchor tag - for example:
Match this text and re
Match this text and replace it
Don\'t match this text
We still need to match this text and replace it
';
$res = preg_replace("#[^]match this text#",'replacement',$a);
echo $res;
?>
This way works. Hope you want realy case sensitive, so match with small letter.