Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:(?P<name>[\p{L}\.\ ]+)\n)? (?:(?P<co>[\p{L}\.\ \/]+)\n)? (?P<street>[\p{L}\ \p{N}\.]+)\n (?:(?<city>[\p{L}\ ]+)\n)? (?P<postal_code>[\p{N}\ ]+)\ (?P<postal_city>[\p{L}\ ]+)(?:\((?<province>[\p{L}\ ]+)\))?\n (?P<country>[\p{L}\ ]+)? $
/
gmx

Description

Match multiline address formats

Submitted by anonymous - a year ago