Regular Expressions 101

Community Patterns

Multiline Address

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 - 10 months ago