Skip to content

Instantly share code, notes, and snippets.

@muthu1809
Created July 21, 2020 17:14
Show Gist options
  • Save muthu1809/1373dbdfe299453306f42426669c1b41 to your computer and use it in GitHub Desktop.
Save muthu1809/1373dbdfe299453306f42426669c1b41 to your computer and use it in GitHub Desktop.
import re #முதலில் இதை இறக்கிக் கொள்ள வேண்டும் - நினைவிருக்கிறது அல்லவா!
def isMobileNumber(sentence): #def என்பது வேலையின் பெயருக்கு முன் கொடுக்கவேண்டிய பைத்தான் குறிச்சொல்.
mobileNumberPattern = re.compile("(0|91)[6-9][0-9]{9}")
return mobileNumberPattern.search(sentence)
#மேல் இருப்பது தான் நம்முடைய வேலை. இப்போது பைத்தானைக் கூப்பிட்டு இந்த வேலையைச் செய்யச் சொல்ல வேண்டுமே!
#கீழ் இருக்கும் வரிகளைப் பாருங்கள்.
sentence = "My mobile no is 918344777333"
mobileNumber_present = isMobileNumber(sentence) #இங்குத் தான், பைத்தானிடம் இந்த வேலையைச் செய்யச் சொல்கிறோம்.
if (mobileNumber_present):
print("Mobile Number is present in the sentence")
else:
print("Mobile 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