I have these 3 strings:
$string = "his";
$str1 = "hi";
$str2 = "s";
So what I want to do is a regex that looks for hi and replaces it. But! if there is s in the string it won't be replaced. Like this.
preg_replace('/'.$str1.'^['.$str2.']/', "replace it with this", $string);
It's not working! (of course not, regex isn't my thing!)
As I said, I don't get this with regex. I want to find $str1 and if $str2 isn't in the string it won't be replaced.