Im trying to exactly match the string using the preg_replace function in php. I only want to match instances with a single "@" character. I also require that the variable be passed as a template.
$x = "@hello, @@hello, @hello, @@hello" $temp = '@hello' $x = preg_replace("/".$temp."/", "replaced", $x);
the result should only be:
$x = "replaced, @@hello, replaced, @@hello"
Thanks in advance.
source share