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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login