Jump to content

Regex problems


rendezvous123

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...
Link to comment
https://forums.phpfreaks.com/topic/4803-regex-problems/
Share on other sites

Archived

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

×
×
  • Create New...

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.