Jump to content


This topic is now archived and is closed to further replies.


Regex problems

Recommended Posts

Here's what i'm having trouble with:
[code]$shout = ereg_replace('\\[color="(.*)"\\](.*)\\[/color\\]', '<font color="\\1">\\2</font>', $shout);[/code]
When, i test it, it works fine, until, another instance of it is found on the same line.
I submit this:
[code][color="blue"]text[/color][/code]It brings back this:
[code]<font color="blue">text</font>[/code]

But, when I submit this:
[code][color="blue"]text[/color][color="blue"]text[/color][/code]It brings back this:
[code]<font color="blue"]stuff[/color][color="blue">stuff</font>[/code]

[b]How can i make it to bring back this?:[/b]
[code]<font color="blue">text</font><font color="blue">text</font>[/code]

I've tried many things, but failed to get what i want...

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.