Regexp matching in SQL
| From: | Brian Anderson | Date: | Mon, 06 Mar 2006 21:10:32 +0000 |
| Subject: | Regexp matching in SQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231553@lists.php.net to get a copy of this message | ||
I am trying to simplify an SQL query that is pretty much like below:
$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression1' OR keyword RLIKE '$expression2' ";
The different terms '$expression1' and '$expression1' come from an array.
Is there any way to within one regular expression to say either term1 or term 2? Something like this where the OR condition would be basically built into the regular expression:
$sql = "SELECT * FROM table WHERE keyword RLIKE '$expression'"; // the $expression would have to signify either a or b.
Does that make sense?