Possible Duplicate:
replace all “foo” between ()
Hello,
I tried to use regex to replace all foo string between the () which between style=" and "
Here’s an example :
blah blah foo blah style="foo text blah (foo and blah foo)"
it should be replaced to be :
blah blah foo blah style="foo text blah (bar and blah bar)"
i tried to use this code but it dont working .
do {
$code = preg_replace('/(style\=\"[^)]*)left(?=[^()]*\))([^)]*\")/U', '\1tempvalue\3', $code, -1, $count);
} while($count != 0);
then im trying to using foreach to get the results,, then replace it normally using preg_replace .
i wish to find the answer 🙂 ,, thank you.
Works on your string, might need modifying a bit to work in all circumstances…