Re: regular expression and exact word search...

From: Date: Thu, 07 Nov 2002 20:57:56 +0000
Subject: Re: regular expression and exact word search...
Groups: php.general 
Request: Send a blank email to php-general+get-123230@lists.php.net to get a copy of this message
How about this one, $word_search = 'blablabla' ; echo eregi_replace("($word_search)","<b>\\1</b>",$html) ; // ----- Original Message ----- From: "BAROILLER Pierre-Emmanuel" <baroiller@daoditu.com> To: <php-general@lists.php.net> Sent: Friday, November 08, 2002 2:42 AM Subject: [PHP] regular expression and exact word search... > Hi! > > does someone know how to find an exact word in a content with html tags ? > I'm using a regexp like this : > > $searchRegEx = "'\b".$word_search."\b'msi"; > > to get boundary word results, but... if the searched word is like 'word or > word. or anything else, the > regular expression doesn't work.. > > if I remove the \b , I've got all words ( but without bound...) > > Any idea? > (the big problem is I'm higlighting found sentences, and .. if the searched > word is part of an html tag, it's very auwfull... ) > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#123230) next »