MySQL Search Query, Anything but Letters
Moderator: General Moderators
MySQL Search Query, Anything but Letters
Can someone please show me the syntax for a query which excludes all entries which do not start with a letter. (a-z/A-Z)
Thank you.
Thank you.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
`field` REGEXP '^[a-zA-Z]'Ok I tried...
And..
Neither of them work and I can't find any examples online. What am I doing wrong?
Code: Select all
$Query = "SELECT `RecordID`, `Word` REGEXP '^[a-zA-Z]' FROM `TABLE` ORDER BY `Word` asc";Code: Select all
$Query = "SELECT `RecordID`, `Word` FROM `TABLE` WHERE `Word` REGEXP '^[a-zA-Z]' ORDER BY `Word` asc";- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
maybe your version of mysql doesn't support regexp's. see mysql online documentation site for more details...
I think this is doing the opposite of what it needs to do. This is returning all results that DO have the letters a-z as the first character. I tried searching for RegEx that would fix it but had no luck.feyd wrote:Code: Select all
`field` REGEXP '^[a-zA-Z]'
Last edited by Benjamin on Tue Apr 25, 2006 12:38 am, edited 1 time in total.