Just to share my solution:
preg_replace('/_color:(.*?)_(.*?)_color_/i', '<font color="$1">$2</font>',
$html);
/Peter
-----Original Message-----
From: Peter Lauri [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 20, 2006 9:42 AM
To: 'PHP General'
Subject: [PHP] preg_replace (again)
Hi group,
I know I am a little bit stupid when it comes to actually figuring out how
to use the preg_match and preg_replace. This is what I am facing:
A string like this: This is some _color:pink_ colored text _color_ that I
want to transfer
Should convert to: This is some <font color="pink">colored text</font> that
I want to transfer
Anyone who see a simple solution to this? Right now I have created an ugly
script that do the same thing, but I want to start to learn and use
preg_match.
Thanks.
/Peter
www.lauri.se <http://www.lauri.se/> - Personal web site
www.dwsasia.com <http://www.dwsasia.com/> - Company web site
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php