UK Postcode Validation - InfoPath Dev
in

InfoPath Dev

UK Postcode Validation

Last post 07-03-2015 06:17 AM by Steven_Smith. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 07-03-2015 06:17 AM

    UK Postcode Validation

     So after searching the internet for a considerable amount of time to try to find the right way to validate UK postcodes to a fairly accurate dataset I have come up with the following solution. For reference the field containing my postcode is called Postcode.

     Using the formatting conditions input the following:

    Field Match Type Condition
    Postcode does not match pattern [A-PR-UWYZ][A-HK-Y]?[0-9]{1,2} ?[0-9][ABD-HJLNP-UW-Z]{2}
    Postcode does not match pattern [A-PR-UWYZ][0-9][A-HJKSTUW] ?[0-9][ABD-HJLNP-UW-Z]{2}
    Postcode does not match pattern [A-PR-UWYZ][A-HK-Y][0-9][CDFGI-LOQSTUZ] ?[0-9][ABD-HJLNP-UW-Z]{2}
    Postcode is equal to GIR 0AA

    All these should end with an "and". Use custom pattern to insert the conditions for pattern matching.

    There are a lot of RegEx examples out there, however InfoPath doesn't fully support it. If anyone has a better solution than this I would be interested to hear it, as this isn't the most elegant of solutions.

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.