How do I find, multiply and replace a number in notepad++?
I’m trying find all exp values in a file and multiplying them by two using the find and replace function, so something like
exp=“2” to exp=“4”
exp=“3” to exp=“6”
exp=“4” to exp=“8”
I can select all the exp values using exp=“(.*)” but I can’t seem to find a way to multiply the wildcard value. exp=“2($1)” just adds a 2 to the front of the wildcard so it ends up as exp=“22” so does anyone know how I can multiply the numbers correctly?
Apologies if I’m missing something really obvious here.
multiplying them by two
The find and replace function (using regular expressions) will not perform any mathematical calculations. Depending on how many different numbers there are you could do simple substitution. The expression can get a bit long winded though.
Another option would be to use one of the supported programming languages through NPP, one is Python Script, however this will require learning it first, again a long winded process.
Third option is to parse it through something like Excel which could do the multiply, again it will take some effort.
Darn, that’s a bit annoying; but at least I know throwing different brackets at the replace line won’t do anything now.
Appreciate the help!