Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^([A-Za-z0-9\s\.\&]+\s+(Place|Terrace|Highway|Road|St?reet?|Road|Lane|Suite|Avenue|Parkway|Court|Boulevard|Rd|Island|Drive|Pike|Floor|St|Falls|Park|Spring|Ave|Drive|Dr|\d+)[.\s]?,?\s?((N|S)?(E|W)?),?[\s0-9\#]*,)(\s[A-Za-z].*,)(\s[A-Za-z\s\.]+)([0-9]+\-?.*)$
/
gm

Description

This pattern matches inconsistent addresses that have various street names and coordinates. This captures the Address 1 & 2, Type of Street, Coordinates (NE, NW, SE,SW) City, State, and Full zip

Submitted by Nadira S Fant - a year ago