RE: [PHP] Regular expresions in MySQL
| From: | Matthias Endler | Date: | Tue, 17 Oct 2000 00:50:34 +0000 |
| Subject: | RE: [PHP] Regular expresions in MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20490@lists.php.net to get a copy of this message | ||
Hi Andrés,
> I don´t find the way to make a Regular expresion that do the follow,
>
> String that match word1 .and. word2 .and. word3 not worry about
> the order in
> the string. The important is that all the words are in the string.
>
> I wrote,
> where string rlike "word1|word2|word3" but this match is only one
> word is in
> the string. How can I change | (or) for an and?
why don't you do the following:
SELECT *
FROM table
WHERE field LIKE '%word1%' AND field LIKE '%word2%' AND field LIKE
'%word3%';
Cheers,
Matthias