ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-general
php-general
Re: [PHP] regex issue
by Greg Donald other posts by this author
Dec 1 2004 1:36AM messages near this date
Re: [PHP] Return value in Combo Box | RE: [PHP] regex issue
On Tue, 30 Nov 2004 17:18:33 -0800, nate@[...].com
<nate@[...].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
Thread:
Greg Donald


Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved