I want to enable a user-friendly search for authors in a books database. 
When an author's name is spelled in several ways (T.S. Eliot; Eliot, T S; 
Eliot, Thomas Stearns, etc.) the user input using these different spellings 
should find all entries from this author. I thought I could get this done 
by isolating last name and initials and building the query (somewhat 
simplified) as "...where author like '%$lastname%' and author REGEXP 
'[[:<:]]$Initial[0][-/A-Za-z\(\)\. ]*[[:<:]]$Initial[1]'"

This, however, also finds authors like 'Thompson, Eliot and Simpson, Ken'. 
To narrow down the search I am now trying to find a way to instruct Mysql 
to find both initials in the required order in two consecutive words only, 
so only in 'T.S.' or 'Thomas Stearns' or minor variants. I cannot discover 
in the Mysql manual, nor in Dubois, nor in Friedl's regex book, how to do 
this. [[:<:]] doesn's have a negation, which would come in handy here.

Are there any regex wizards who could help? Are there other ways to 
accomplish what I want?

Thanks in advance,

Piet Wesselman 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to