Skip to main content
Nintex Community Menu Bar
Solved

How do I do a postcode validation in a control on a from?

  • November 28, 2019
  • 3 replies
  • 65 views

Forum|alt.badge.img+1

Hi There, I have created a form where I am asking the user to input a postcode, how do I validate the field to ensure it is a genuine Postcode format for the UK?

 

I am using NWC

 

Thanks

Best answer by butlerj

@AndyEmery looks like this regular expression should do the trick: 

^[A-Z]{1,2}[0-9][A-Z0-9]? ?[0-9][A-Z]{2}$

3 replies

SimonMuntz
Nintex Employee
Forum|alt.badge.img+23
  • Nintex Employee
  • November 28, 2019
Hi,
Because of the amount of combinations that a UK postcode can have this may be a little difficult. I looked at using a Text Mask but that won't work. Cant really see how to impliment a regular expression validation.

Chris_Ben
Nintex Employee
Forum|alt.badge.img+14
  • Nintex Employee
  • June 16, 2020

Here are some suggestions in stackoverflow but none are comprehensive - including the regex suggested by the UK Government themselves!  https://stackoverflow.com/questions/164979/regex-for-matching-uk-postcodes


butlerj
Nintex Employee
Forum|alt.badge.img+20
  • Nintex Employee
  • Answer
  • June 17, 2020

@AndyEmery looks like this regular expression should do the trick: 

^[A-Z]{1,2}[0-9][A-Z0-9]? ?[0-9][A-Z]{2}$