I have a file ,and i need to delete the regex matching part and write remaining lines to a file.
Regex matching Code to delete file:
import re
with open("in1.txt") as f:lines = f.read()m = re.findall(r'(?s)(my _car_\s*.*?)my', lines)
Input file:
my _car_(10)skodaaudimy homegoodmy _car_(11)benz
Expected output:
my homegood
Please help me to fix it,answers will be appreciated!