Gossamer Forum
Home : General : Databases and SQL :

MySQL Regular Expression not working as expected

Quote Reply
MySQL Regular Expression not working as expected
I am not that good with regular expressions yet. I am running a query that has a where clause that looks like this:
WHERE `Address` REGEXP '^[0-9+[space.]X]'
This is not doing what I want it to do. I want to grab any address that starts with any number of numbers, is then immediately followed by a space, and is then immediately followed by the 'X' character. It does not matter what is after the 'X' character. What am I doing wrong? Any help will be appreciated.
Quote Reply
Re: [INTPnerd] MySQL Regular Expression not working as expected In reply to
I got the answer from another forum. I just needed to use:
'^[0-9]+ X.*'