Reply to Re: String Replace

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация