regex issue
| From: | nate at savingadvice dot com | Date: | Wed, 01 Dec 2004 01:18:33 +0000 |
| Subject: | regex issue | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203195@lists.php.net to get a copy of this message | ||
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, '<font color="red">$0</font>', $txt);
----------------
This captures "array(" though and I just want "array".
Thanks for pointing out my stupidity,
Nate Sanden
nate@savingadvice.com
http://www.savingadvice.com