Exp 9 python

0

 Create a program that uses regular expressions to find all instances of a specific pattern in a text file. 


import re


pattern = r'\bt\w+'


with open("text.txt", "r") as file:

    text = file.read()


matches = re.findall(pattern, text)


print("Matches found:")

for match in matches:

    print(match)

Post a Comment

0Comments

GUYS IF YOU HAVE ANY DOUBT. PLEASE LET ME KNOW

Post a Comment (0)