import re
with open('test.txt','r') as f:
str1 = f.read()
match_rex = re.compile(r'.*?(ADJECTIVE).*?(NOUN).*?(VERB).*?(NOUN).*')
match_object = match_rex.search(str1)
#print(match_object.groups())
for i in match_object.groups():
#print(i)
word_rex = re.compile(i)
str1 = word_rex.sub(input(f'Enter an {i.lower()}:\n'),str1,count=1)
with open('test2.txt','w') as f:
f.write(str1)
print(str1)
01-25
10-27