Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
([A-Z]{1,2}[0-9]{1,2}[A-Z]{0,1}(\s[0-9][A-Z]{0,2})?)
/
g

Description

No perfect, missing GIR postcodes, but should match most of the postcodes for extraction. It's not a postcode validator, just an extractor, validation should be done after extraction.

Submitted by anonymous - 8 years ago