Skip to content

Instantly share code, notes, and snippets.

@muthu1809
Created July 22, 2020 10:34
Show Gist options
  • Save muthu1809/b13b0720df44696dd7b43730fe5e0d9a to your computer and use it in GitHub Desktop.
Save muthu1809/b13b0720df44696dd7b43730fe5e0d9a to your computer and use it in GitHub Desktop.
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