I'm trying to replace the first (is|are) in a string to (is not|are not), but ONLY the first part. I want it to skip any other (is|are) it finds in the string. How would I be able to do that?
$text = "it is what they are";
$replacedText = preg_replace("~\b(is|are)\b~", "$1 not", $text);
Actual Result:
it is not what they are not
Need Result:
it is not what they are