Posted by burgermeister01@gmail.com on 09/24/07 18:07
On Sep 24, 12:54 pm, RageARC <rage...@gmail.com> wrote:
> I have:
>
> $string = "text ... [COLOR]FFFFFF[/COLOR] text... ";
> $replacement = "<div id='THECOLOR'>THECOLOR</div>";
>
> Where THECOLOR has to be the color the user inserted inside the tags.
> I could use preg_replace, but I don't know regex. Can you help me?
This is untested but try this out...
preg_replace("\[COLOR\][a-zA-Z]+\[/COLOR\]", "<div id = '" . $color .
"'>" . $color . "</div>", $string);
[Back to original message]
|