Created
July 22, 2020 10:34
-
-
Save muthu1809/b13b0720df44696dd7b43730fe5e0d9a to your computer and use it in GitHub Desktop.
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
import re | |
def isLandLine(sentence): | |
landLinePattern = re.compile(r'((91)((\d){2,4}))-([1-9][0-9]{5,8})') | |
present = landLinePattern.search(sentence) | |
std = len(present.group(1)) | |
phone = len(present.group(5)) | |
if (std+phone)==12: | |
return True | |
else: | |
return False | |
sentence = 'My number is 914462-521129' | |
landline_present = isLandLine(sentence) | |
if(landline_present) | |
print("Landline number is present in the sentence") | |
else: | |
print("Landline Number is not present in the sentence") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment