Skip to content

Instantly share code, notes, and snippets.

@scottsbaldwin
Last active April 6, 2017 15:45
Show Gist options
  • Save scottsbaldwin/5a3571366ff54b7e6250f52066e17128 to your computer and use it in GitHub Desktop.
Save scottsbaldwin/5a3571366ff54b7e6250f52066e17128 to your computer and use it in GitHub Desktop.
Regex for Bulk Import Address and Phone Formatting

Regex for Bulk Import Address and Phone Formatting

Address Regex

^(.*), ?(.+), ?(UT),? ((\d{5})(-\d{4})?)
$1\t\t$2\t$3\t$5

Address 1 and 2 refinement

(.+?),? (Suite|SUITE|Ste|STE|BLDG|Bldg|Unit|UNIT|UNITS|Units) (.+)$
$1\t$2 $3

Phone Number Regex

^(1[-.])?\(?(\d{3})\)?[ -.,]?(\d{3})[-.]?(\d{4})
$2-$3-$4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment