I searched a lot but I was unable to find a solution to my problem which is I want to search for a particular word from the input (text). Though I only find the first letter. my code is as:
import re
regex = r"([a-zA-Z]+)"
datm = str(input('Enter a passage to search for a word :'))
if re.search(regex, datm):
match = re.search(regex, datm)
print("Full match: %s" % (match.group(0)))
else:
print("The regex pattern does not match. :(")
Thanks for the answer, you don't have to answer if you are going to give minus.
Aucun commentaire:
Enregistrer un commentaire