Regular Expressions 101

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
^([AC-FHKNPRTV-Y]{1}[0-9]{2}|D6W)[ ]?[0-9AC-FHKNPRTV-Y]{4}$
/
mgi

Description

Eircode validation for new postcodes identifiers in Republic of Ireland. Case-insensetive for easier user input. Added optional space separator to follow same pattern as in UK post codes and in examples used in eircode spec.

Submitted by Arek Jaworski - 8 years ago