Re: Searching for a whole word

From: Date: Wed, 22 Nov 2000 17:46:06 +0000
Subject: Re: Searching for a whole word
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4668@lists.php.net to get a copy of this message
Have a look at "function.ereg.html" on the php on-line manual. HTH. Jayme. http://www.conex.com.br/jjeffman -----Mensagem Original----- De: Francisco Javier Lozano Bastidas <fralozan@mangle.univalle.edu.co> Para: Jamie Alessio <alessio@mvfx.com> Cc: <mysql@lists.mysql.com>; <php-db@lists.php.net> Enviada em: terça-feira, 21 de novembro de 2000 07:38 Assunto: Re: [PHP-DB] Searching for a whole word > > Thanks .. But it doesn't work good ... "LIKE" is good to find > "substrings", i.e. If $pattern = 'a', LIKE will return any word containing > that character, I need a whole word ... In the H Appendix from MySQL > manual is explained the REGEXP '[[:<:]]word[[:>:]]' operator but I don't > know how to make it work in PHP ... Tks! > > Please excuse my spell ... English is not my native language. ;) > > On Tue, 21 Nov 2000, Jamie Alessio wrote: > > > > I need to search in a MySQL table for a whole word. When I do it > > > from msyql prompt it's ok : > > > > > > select * from table_name where column_name REGEXP '[[:<:]]word[[:>:]]' > > > > > Why not try something like > > select * from table_name where column_name LIKE '%word%' > > > > That should match the word you are looking for without having to use a regular expression. > > > > - Jamie > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#4668) next »