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…

VN:F [1.8.3_1051]
Rating: 0.0/5 (0 votes cast)
VN:F [1.8.3_1051]
Rating: 0 (from 0 votes)

Tags: , , ,

Comments are closed.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes