RE: [PHP] regex issue
| From: | nate at savingadvice dot com | Date: | Wed, 01 Dec 2004 01:48:35 +0000 |
| Subject: | RE: [PHP] regex issue | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203200@lists.php.net to get a copy of this message | ||
I don't want to match something like "linear" though. I only want to match
"line " or "line(" or "line;" and only replace the "line"
portion of it.
Thanks,
Nate
-----Original Message-----
From: Greg Donald [mailto:destiney@gmail.com]
Sent: Tuesday, November 30, 2004 5:36 PM
To: php-general@lists.php.net
Subject: Re: [PHP] regex issue
On Tue, 30 Nov 2004 17:18:33 -0800, nate@savingadvice.com
<nate@savingadvice.com> 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)", "<font color=red>\\1</font>",
$source);
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php