Regular Expressions 101

Community Patterns

UK Postcode

0

Regular Expression
ECMAScript (JavaScript)

/
^([a-zA-Z]{1,2}\d{1,2})\s*?(\d[a-zA-Z]{2})$|^([a-zA-Z]{1,2}\d{1,2})$
/
i

Description

Tests UK Postcode with alternative for Postcode Prefix

Submitted by Calvin Willman - 8 years ago