Need help with finding and replacing
-
Hello, i have 30 notepad files in which i want to change a number at certain lines.
This is the lines that are found in each document:
Size { # [range: 1 ~ 256000, default: 1000] I:max=1000 # [range: 1 ~ 256000, default: 500] I:min=500I want to change the number after i:max and i:min in each document, but be aware that there are other places where these 2 appear and i need to change the numbers only in these specific lines. How can i do that? Also, the number after ''default: ‘’ it is different in each document in both lines.
—
moderator added code markdown around text; please don’t forget to use the
</>button to mark example text as “code” so that characters don’t get changed by the forum -
Your specs are more vague than you think they are.
Assuming you want to replace any positive integer immediately after that specific
I:max=with987and any positive integer immediately after that specificI:min=with654, then it could be done with something like:
FIND =(?-is)(Size\s+{\s*.*\R\s*I:max=)\d+(\s*.*\R\s*I:min=)\d+
REPLACE =${1}987${2}654
SEARCH MODE =Regular Expression
REPLACE IN FILEShopefully, you can figure out what to change in order to replace with values other than
987or654highly recommended: always back up your data before trying a regex that someone hands you; always try a new regex on a single file and make sure it behaves as you expect before trying on the full 30 files.
----
Useful References