lunchboxbill
lunchboxbill

Reputation: 191

UK postcode reg ex with space

I need a javascript reg ex that forces the user to enter a space in their UK post code.

Can somebody please help? Those I have found seem to allow for optional spaces which is not what I'm after.

Upvotes: 1

Views: 455

Answers (1)

Ross McLellan
Ross McLellan

Reputation: 1881

Something like this? Believe it catches all UK postcodes, at least it caught all the ones I can think of off the top of my head

/^(\w{1,2}\d{1,2}\w?\s\d\w{1,2})$/

Upvotes: 1

Related Questions