Regular expressions
Posted: Thu Feb 08, 2007 7:22 am
I am trying to replace the fist occurance of a string in string2. I am trying to use preg_replace.
I want to be able to replace a string but I also want to be able to use vars within my pattern. How can this be done?[/s]
Code: Select all
$repThis = "x" . $currX . " y" . $currY;
$repWith = "xp$repWithX yp$repWithY";
$test = preg_replace($repThis, $repWith, $test, 1);