Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LIKE '[0-9]%' 1

Status
Not open for further replies.

Triion

Programmer
Sep 20, 2005
6
BE
Hi,

I want to make a catalog, in which the user can search by the startingletter of the game, A through Z, which is easy with "WHERE column LIKE '$letter%'" where $letter is PHP for the letter the user has chosen.

But There are games that start with a number... I'd like to make a query that gives the games that start with a number [0-9], but I have no idea how...
Is there a way to add a regular expression in the LIKE-clause?

How would you solve this?

Thanx in advance,
Triion
 
You can use the REGEXP (or RLIKE, which is identical) operator:
[tt]
WHERE column REGEXP '^[0-9]'
[/tt]
REGEXP uses a different syntax to LIKE. The syntax is explained in the MySQL manual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top