Find and replace subset of string
-
Hi there,
I have a large file in which I want to replace any strings in my file where Buchwert has a decimal place and replace it with 0
So this is ok
bestand=“-6718” buchwert=“0” wrtmndrng_kmlrt=“0”But this is a problem
bestand=“6719” buchwert=“0.831392131958484” wrtmndrng_kmlrt=“0”How do I do it without deleting anything past the second "?
-
In the end I got this working with:
Find what:
"buchwert=“0.[0-9]+” "Replace:
buchwert=“0” -
Search for Regular Expression:
buchwert="0\.\d+"
Replace with:buchwert="0"
If you need to replace any number with decimals search for
buchwert="\d+\.\d+"
-
Ok, I see you found it by yourself. Note that \d is equivalent to [0-9]. But you need to escape the
"."
to"\."
or else it will match any character e.g. “0n234” would also match.