views:

89

answers:

1

I want to change the color of text inside single quotes, but i have also want to change the color of parenthasis as long as they arent in quotes. this is what i have but its not working as planned.

"/([^'])\((.*?)\)([^']+)/is" => "$1<span style=\"color: ".$ccode['green']."\">(</span>$2<span style=\"color: ".$ccode['green']."\">)</span>$3"

Im using preg replace and this is just a part of the array. any ideas?

A: 

I would recommend using one of the fine online regex testers available. A good example of one is at http://www.regextester.com/ More than likely your regex isn't parsing as you expect. Using a visual tester helps pinpoint the problem.

Bill