Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Python

r"
^[a-zA-Z]{1,2}\d[a-zA-Z\d]?\s?\d[a-zA-Z]{2}$
"
gm

Description

Detects UK postcodes (minimal edge cases)

Submitted by anonymous - 3 years ago