|
Posted by "George Pitcher" on 01/20/06 17:21
David,
No html involved. Just db results.
I've found that eregi_replace() does the job adequately, if not perfectly.
Us typesetters are hard to please when it comes to string handling.
Cheers
George
> -----Original Message-----
> From: David Grant [mailto:djg@php.net]
> Sent: 20 January 2006 2:54 pm
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] problem encountered with stristr-based function
>
>
> George,
>
> George Pitcher wrote:
> > For info, I am trying to highlight search terms in results.
>
> If you're searching and replacing within HTML, you ought to be aware of
> issues if someone's search term happens to be an HTML tag or attribute.
> For example, Alice might search for "href" and get the following:
>
> <a <b>href</b>="URL">Text</a>
>
> back, which is clearly fubar, which highlights the necessity for some
> handy regex skills. Following a quick google, I found this page:
>
> http://aidanlister.com/repos/?file=function.str_highlight.php
>
> David
> --
> David Grant
> http://www.grant.org.uk/
>
> http://pear.php.net/package/File_Ogg 0.2.1
> http://pear.php.net/package/File_XSPF 0.1.0
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
[Back to original message]
|