The original problem was User X submits a character string A.
A PHP scripts uses A to search for it's occurences in a DB, ignoring special characters. The result of ze search is a list of character strings M-LIST with matches. This list gets outputted to the user X, but before that all the matching strings should be replaced with '<span style="color: #FF0000">'..'</span>' If i clearly got the OP then he is using MySQL to perform the search. I guess he is doing it with MATCH. So MySQL already found the match and in PHP it has to be done again ... eg. The table has 2 entries, string1 and string2 .. string1 = 'Thís ís an éxámplè stríng wíth áccénts.' string2 = 'This is an example string without accents.' Now the user searches for "ample": search = '*ample*' Both string have matches due to accent-insensitivity (AI). Now the result is outputted with highlighting .. *Thís ís an éx*<span style="color: #FF0000">*ámplè*</span>* stríng wíth áccénts.* *This is an ex*<span style="color: #FF0000">*ample*</span>* string without accents.* So since MySQL already did the job, why not get the occurances from it? I'm not an MySQL expert, but I know google and found something called string functions. Especially a "locate" function got my interest. http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_locate Now shouldnt it be possible to create a query that searches the db for matches and additionally uses the string function? I have no idea, but maybe some MySQL-expert out there has ... Yeti On Tue, Jul 15, 2008 at 7:17 PM, Andrew Ballard <[EMAIL PROTECTED]> wrote: > On Tue, Jul 15, 2008 at 12:30 PM, tedd <[EMAIL PROTECTED]> wrote: > > At 10:15 AM -0400 7/15/08, Andrew Ballard wrote: > >> > >> On TueWell, OK, I can think of one optimization. This takes advantage of > >> the > >> fact that preg_replace can accept arrays as parameters. In a couple > >> very quick tests this version is roughly 30% faster than my previous > >> version: > > > > -snip- > > > > Hey, when you finally get finished with that function, please let me know > I > > would like to copy it. :-) > > > > Cheers, > > > > tedd > > All yours. I figure I'm done with it. (At least until I actually need > to use it for something and then I have to test it for real. :-) ) > > Andrew > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >