Using regular expressions in mysql
Click for Post Details
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…
VN:F [1.8.1_1037]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.1_1037]

Tags: PHP, PHP5, Programming, Tips
This entry was posted
2 months, 3 weeks ago on Tuesday, November 17th, 2009 at 23:58 and is filed under PHP.
You can follow any responses to this entry through the RSS 2.0 feed.
Responses are currently closed, but you can trackback from your own site.