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!

Postcode Regexp

Status
Not open for further replies.

DannyTmoov2

IS-IT--Management
Jan 7, 2003
49
GB
I'm trying to get the following to return false:
SELECT TRIM(' EX7 5AW') REGEXP "^E|EC|EN|N|NW|SE|SW|W|WC[1-9][0-9]? ";

Which basically should return true for london postcodes. I.E. if the first part (the textual chars) is in E|EC|EN|N|NW|SE|SW|W|WC and the second part (the numbers) is either one or two numerical values between 1 and 9.

The above returns true when it shouldn't because EX isn't in the list. Any help much apprecaited
 
i think putting the char part in brackets, either () or [], should do the job
^[E|EC|EN|N|NW|SE|SW|W|WC][1-9][0-9]?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top