MGBlogA useless rant...Postcode Regular Expression- March 30, 2006 The following regular expression can be used to validate UK postcodes. I'm posting this here as I can never find it when I need it.(GgIiRr 0Aa2)(((A-Za-z0-91,2)((A-Za-zA-Ha-hJ-Yj-y0-91,2)((A-Za-z0-9A-Za-z)(A-Za-zA-Ha-hJ-Yj-y0-9A-Za-z)))) 0-9A-Za-z2)$It is not case sensitive. It matches postcodes starting GIR which are for GiroBank which may not be required.http://www.mgbrown.com/PermaLink66.aspx RegEx Editor Release 1.1- March 20, 2006 There is a new version of my RegEx editor available for download from the Downloads page. This includes a couple of very minor bug fixes plus the following enhancements: Load a text file into the test pain. Save text results to a file. Copy the regular expression already formatted for use in VB or C code.http://www.mgbrown.com/PermaLink65.aspx |