Skip to content

Added an Address-Parsing Regex#41

Open
Hobadee wants to merge 1 commit intolukehaas:masterfrom
Hobadee:master
Open

Added an Address-Parsing Regex#41
Hobadee wants to merge 1 commit intolukehaas:masterfrom
Hobadee:master

Conversation

@Hobadee
Copy link
Copy Markdown

@Hobadee Hobadee commented Nov 15, 2018

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

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.

The matches are as follows
Match 1: Street address.
Match 2: Apt/Suite/Unit #
Match 3: City.
Match 4: State.
Match 5: Postal Code.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant