Created
December 9, 2018 19:02
-
-
Save serpent213/282f8910e346faf83b1919c64245c23d to your computer and use it in GitHub Desktop.
phone number validation (regex)
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
#!/usr/bin/env python | |
import re | |
def isPhoneNumberRegEx(text): | |
return bool(re.match(r'^\d{3}-\d{3}-\d{3}$', text)) | |
print('666 666 666 is a phone number: ') | |
print(isPhoneNumberRegEx('666-666-666')) | |
print('Moshi moshi is a phone number') | |
print(isPhoneNumberRegEx('Moshi moshi')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment