REGEX UK Postcode

Home Forums Quform WordPress REGEX UK Postcode

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17628
    kendavies
    Participant

    Hi. I’m trying to get a form to validate a uk post code input. I have copied the regex from a UK government doc dated November 2015, so I assume if must be the latest version. I have pasted this into the Pattern field on the validators section on the part of the form containing the postcode (see attachment) but it’s showing postcodes as invalid when you submit the form

    This is the pattern I have used:

    ^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-
    9]{1,2})|(([AZa-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][AZa-z]{2})$

    Attachments:
    You must be logged in to view attached files.
    #17638
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy