Archive for the ‘PHP’ Category
Using regular expressions in mysql
Using the keyword LIKE in a SELECT query is nice and easy but sometimes very limited. For more complex searches, use the keyword REGEXP.
It allows you to enter a Regular Expression search.
$query="SELECT * FROM `db`.`tbl` WHERE `NAME` REGEXP '^Ha+([a-zA-Z]*)'";
Will return ok for Hani, Hamed, Hazem, etc…

