开发者

PHP not change color in quotes

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 th开发者_运维知识库e array. any ideas?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜