On Wed, September 20, 2006 11:20 am, Pawel Miroslawski wrote:
Hi
it's example script:
?php
$string = This is some _color:pink_ colored text _color_;
$patterns[0] = '/_color:(.*?)_/';
$patterns[1] = '/_color_/';
$replacements[0] = 'font color=$1';
$replacements[1] = '/font';
echo
On Wed, 2006-09-20 at 11:45 +0700, Peter Lauri wrote:
Just to share my solution:
Out of curiosity, why don't you go with the very well known BBCode
system?
preg_replace('/_color:(.*?)_(.*?)_color_/i', 'font color=$1$2/font',
$html);
Hopefully this is a private system, otherwise someone not
).
This is a private system, so I do not worry so much :)
/Peter
-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 20, 2006 2:13 PM
To: Peter Lauri
Cc: 'PHP General'
Subject: RE: [PHP] preg_replace (again) [solved]
On Wed, 2006-09-20 at 11:45 +0700
PM
To: Peter Lauri
Cc: 'PHP General'
Subject: RE: [PHP] preg_replace (again) [solved]
On Wed, 2006-09-20 at 11:45 +0700, Peter Lauri wrote:
Just to share my solution:
Out of curiosity, why don't you go with the very well known BBCode
system?
preg_replace('/_color:(.*?)_(.*?)_color_/i
Hi
it's example script:
?php
$string = This is some _color:pink_ colored text _color_;
$patterns[0] = '/_color:(.*?)_/';
$patterns[1] = '/_color_/';
$replacements[0] = 'font color=$1';
$replacements[1] = '/font';
echo preg_replace($patterns, $replacements, $string);
?
It should be ok, but i
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
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
7 matches
Mail list logo