Created
February 6, 2012 16:39
-
-
Save jimmykurian/1753172 to your computer and use it in GitHub Desktop.
A Python program, that tests regular expressions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RegularExpressions.py - Jimmy Kurian | |
import re | |
for test_string in ['555-1212', 'ILL-EGAL']: | |
if re.match(r'^\d{3}-\d{4}$', test_string): | |
print test_string, 'is a valid US local phone number' | |
else: | |
print test_string, 'rejected' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment