Re: Searching for a whole word

From: Date: Tue, 21 Nov 2000 09:38:04 +0000
Subject: Re: Searching for a whole word
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4625@lists.php.net to get a copy of this message
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 > >

« previous php.db (#4625) next »