Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(([A-Z])*(\d+)([A-Z])*)(-|\/|&)*(([A-Z])*(\d+)([A-Z])*)*((\/)*(([A-Z])*(\d+)([A-Z])*))*
/
gm

Description

The regular expression checks for the street numbers or apartment numbers of addresses. It also assumes that the numbers can have a prefix or suffix. Unit/Apartment numbers are of the form Unit Number/Street Number e.g. 10/12.

Submitted by anonymous - 5 years ago