Re: [PHP] regex issue

2004-11-30 Thread Rick Fletcher
[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

RE: [PHP] regex issue

2004-11-30 Thread nate
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: $

Re: [PHP] regex issue

2004-11-30 Thread Greg Donald
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