Created
July 21, 2020 17:14
-
-
Save muthu1809/1373dbdfe299453306f42426669c1b41 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 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