IT45200

Untitled

Aug 22nd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import re
  2. def is_phone_number(text):
  3.     reg = re.compile("\d{3}[-]\d{3}[-]\d{4}")
  4.     results = reg.findall(text)
  5.     return results
  6.    
  7.  
  8. message = 'Call me at 415-555-1011 tomorrow. 415-555-9999 is my office.'
  9.  
  10. for chunk in is_phone_number(message):
  11.     print('Phone number found: ' + chunk)
  12. print('Done')
Advertisement
Add Comment
Please, Sign In to add comment