Skip to content

Instantly share code, notes, and snippets.

@codelingoblog
Created February 22, 2017 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codelingoblog/b0e6649052f46ea50041c6b7c71321a5 to your computer and use it in GitHub Desktop.
Save codelingoblog/b0e6649052f46ea50041c6b7c71321a5 to your computer and use it in GitHub Desktop.
import re
# regex to match Washington D.C phone numbers
regex = r"\b202\-\d{3}\-\d{4}"
file = open("phone_numbers.txt", "r")
phonenumbers = file.read()
print(re.findall(regex, phonenumbers))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment