-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
hello. How can I make a multiple search and replace on files on a Python code? For example I have a folder with 300 html files. I want to use 5 regex find/replace formulas, in the order I want, as to modify the content of those files.
Besides, I must use also the option Dot matches newsline for some regex formulas.
FIND: (<link rel="canonical" href="(.*?)" />.*?)(<meta property="og:url" content=").*?("\/>)
Replace by: \1\3\2\4
and this is a simple find/replace regex:
FIND: <title>.*\K\|(.*)(</title>)
Replace by: \x20|\x20Something Else \(zh\)\x20\2
So both formulas, must be use in the same Python script, one after another, so after run the code to modify all my files from folder. How can I do that?
Metadata
Metadata
Assignees
Labels
No labels