Skip to content

Instantly share code, notes, and snippets.

@mattjbarlow
Last active December 27, 2015 20:49
Show Gist options
  • Save mattjbarlow/7387555 to your computer and use it in GitHub Desktop.
Save mattjbarlow/7387555 to your computer and use it in GitHub Desktop.
import re
re.compile(
'''
(\d{3}) # Search for 3 digits and group them.
\D* # Followed by 0 or more non digit characters.
(\d{3}) # Followed by 3 digits grouped.
\D* # Followed by 0 or more non digit characters.
(\d{4}) # Followed by 4 digits grouped.
\D* # Followed by 0 or more non digit characters.
(\d*)$ # Followed by 0 or more digits until the end of the string.
''',
re.UNICODE | re.VERBOSE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment