Skip to content

Instantly share code, notes, and snippets.

@axiak
Created June 26, 2010 05:43
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 axiak/453818 to your computer and use it in GitHub Desktop.
Save axiak/453818 to your computer and use it in GitHub Desktop.
from typedispatch import *
@dispatch(regexmulti(r'(\d{3})\D{0,2}(\d{3})\D?(\d{4})'))
def phone_numbers(phone_numbers):
for match in phone_numbers:
print '-'.join(match.groups())
@dispatch()
def phone_numbers(text):
print "Could not find a phone number :-("
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment