Regular Expressions 101

Community Patterns

Community Library Entry

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 - 9 years ago