RegexHub icon indicating copy to clipboard operation
RegexHub copied to clipboard

Added an Address-Parsing Regex

Open Hobadee opened this issue 7 years ago • 0 comments

Regex which parses a multi-line address into its component parts. Address can be formatted as a single line with commas, or multiple lines. This can probably be made better by someone smarter than myself as it is currently not foolproof. At a minimum, the Street, City, and State must exist, otherwise nothing will match or the match will be incorrect.

The matches are as follows

  1. Match 1: Street address.
  2. Match 2: Apt/Suite/Unit #
  3. Match 3: City.
  4. Match 4: State.
  5. Match 5: Postal Code.
  6. Match 6: Country

Examples of addresses which match:

123 Easy Way Somecity, AK

123 Easy Way Unit 1 Somecity, AK 12345 USA

123 Easy Way, Somecity, AK

123 Easy Way, Unit 1, Somecity, AK 12345 USA

Hobadee avatar Nov 15 '18 23:11 Hobadee