[EMAIL PROTECTED] wrote:
All I want to do is capture the keyword (array, break, echo, etc) and color
it.
$txt = "this is an array('test')";
$pattern = "/(array|break|echo|continue)([\(.|\s.|\;.])/";
echo preg_replace($pattern, '$0', $txt);
This captures "array(" though and I just want "array".
Th
Tuesday, November 30, 2004 5:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] regex issue
On Tue, 30 Nov 2004 17:18:33 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> All I want to do is capture the keyword (array, break, echo, etc) and
color
> it.
I'd do it like this:
$
On Tue, 30 Nov 2004 17:18:33 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> All I want to do is capture the keyword (array, break, echo, etc) and color
> it.
I'd do it like this:
$source = 'this is a line of text';
$term = 'line';
$text = eregi_replace("($term)", "\\1", $source);
--
Gre
3 matches
Mail list logo