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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 12, 2010, 7:05 AM EDT
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 11, 2010, 9:41 AM EDT
Usama Hamdan5 reputationPosted Apr 12, 2010, 4:56 AM EDT
Dipa AhujaRank #1,168 · 1.5K reputationPosted Apr 12, 2010, 7:16 AM EDT
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 Hamdan5 reputationPosted Apr 13, 2010, 12:51 AM EDT