Regular Expression UK Post Code Validation Pattern

  • 20 September 2017
  • 2 replies
  • 1 view

Hi

 

Does anyone know the validation pattern to set for a UK Post Code?  I have searched and tried a number of different patterns but I can't get any to work.

 

Kind Regards

Sana


2 replies

Badge +6

Hello,

 

Hope this will help you . /[A-Z]{1,2}[0-9][0-9A-Z]?s?[0-9][A-Z]{2}/gi;

Didn't work.  I read in another post that you had to put ^ at the beginning and $ at the end.

 

When I type e.g. SS0 0RY doesn't like it.  I tried without spaces and still complains.  Any ideas?

Reply