Asterisk

Untitled

Jan 24th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. import re
  2. for test_string in ['555-1212', 'ILL-EGAL']:
  3.     if re.match(r'^\d{3}-\d{4}$', test_string):
  4.         print test_string, 'is a valid US local phone number'
  5.     else:
  6.         print test_string, 'rejected'
Add Comment
Please, Sign In to add comment