Re: Regular Expressions.
| From: | Andrey Hristov | Date: | Tue, 20 Nov 2001 13:49:45 +0000 |
| Subject: | Re: Regular Expressions. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75244@lists.php.net to get a copy of this message | ||
$message = preg_match ("~\[color=([\w#]+)\](.*?)\[/color\]~", "<font
color="$1">$2</font>");
try with this
----- Original Message -----
From: "Jeff Lewis" <jeff@hyrum.net>
To: <php-general@lists.php.net>
Sent: Tuesday, November 20, 2001 3:37 PM
Subject: [PHP] Regular Expressions.
I'm trying to port over some Perl to PHP and have come to a string of regular expressions like
this. There are probably 30 of them:
$message =~ s~\[color=([\w#]+)\](.*?)\[/color\]~<font
color="$1">$2</font>~isg;
$message =~ s~\[black\](.*?)\[/black\]~<font color=000000>$1</font>~isg;
$message =~ s~\[white\](.*?)\[/white\]~<font color=FFFFFF>$1</font>~isg;
How can I accomplish the same in PHP?
$message = preg_match ("\[color=([\w#]+)\](.*?)\[/color\]", "<font
color="$1">$2</font>")
I was thinking that is how it would be done but I am getting errors.
Jeff