Skip to content

Commit

Permalink
Merge pull request #472 from seendsouza/master
Browse files Browse the repository at this point in the history
added a python phone number validator
  • Loading branch information
ambujraj authored Oct 6, 2018
2 parents 9690f7a + 9a2fcf6 commit 5c6945a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions telephone-validator/validator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import re

def tel_num_validator(telephone_number):
# Checks to see if input is a valid telephone number
return re.search("^\(?([0-9]{3})\)?[-.●]?([0-9]{3})[-.●]?([0-9]{4})$",telephone_number)

if __name__ == "__main__":
telephone_number = input("Telephone Number: ")
print(tel_num_validator(telephone_number))

0 comments on commit 5c6945a

Please sign in to comment.