Textbox validation
Hi, I'm trying to validate a post code text box for my A-level Computing project. Does anyone have a simple solution I can use to help me complete the project. Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipa AhujaPosted Apr 12, 2010, 11:05 AM
Usama HamdanPosted Apr 13, 2010, 4:51 AM
Dipa AhujaPosted Apr 12, 2010, 11:16 AM
UK Post Code parsing pattern:
(?:[ABD-HJLNP-UW-Z]{1,2})(?:(?:\d{1,2})|(?:\d[ABD-HJLNP-UW-Z])))\s*(?\d[ABD-HJLNP-UW-Z]{2})$
A9 9AA A99 9AA A9A 9AA AA9 9AA AA99 9AA AA9A 9AA^(?
Captures the first section of the post code to the named group "OutCode" and the second section of the post code to the named group "InCode".
UK Post Code validation pattern:
^(?:[ABD-HJLNP-UW-Z]{1,2})(?:(?:\d{1,2})|(?:\d[ABD-HJLNP-UW-Z]))\s*\d[ABD-HJLNP-UW-Z]{2}$
Valid UK postal codes follow the below patterns:
Usama HamdanPosted Apr 12, 2010, 8:56 AM
Dipa AhujaPosted Apr 11, 2010, 1:41 PM