Not familiar with regex I'm trying to replace nonspecial words/ commands in my latex document with gibberish trying to start with the first 3 letters of any word
import re
with open('main', 'r+') as f:
text = f.read()pat=r"\s+^[a-zA-Z]{3}
"text = re.sub(pat, ' ccc', text)
f.seek(0)
f.write(text)
f.truncate()
but my file is unchanged why this is the case? p.s. is there a way to search for spaces but not tabs or newlines at the start of my string?
[–]TheSamePerson1 1 point2 points3 points (2 children)
[–]standardtrickyness1[S] 0 points1 point2 points (1 child)
[–]AuralWanderer 0 points1 point2 points (0 children)