Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an Address-Parsing Regex #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Hobadee
Copy link

@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