RE: [PHP] preg_replace (again) [solved]

From: Date: Wed, 20 Sep 2006 04:45:38 +0000
Subject: RE: [PHP] preg_replace (again) [solved]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-241961@lists.php.net to get a copy of this message
Just to share my solution: preg_replace('/_color:(.*?)_(.*?)_color_/i', '<font color="$1">$2</font>', $html); /Peter -----Original Message----- From: Peter Lauri [mailto:lists@dwsasia.com] 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

« previous php.general (#241961) next »