Need help search and replace with wildcards
-
Need to replace , with . in a json file but only for certain lines
I have many lines that look like this
, “VALSUM”:“92,55964588409961”, "VALSUM":",25" , "VALSUM":"9266,34657"
and only should replace lines that contain VALSUM all other lines with comma should stay untouched
I was hoping to solve it with regex
“VALSUM”:“\d*,\d*” seems to work so I find the line but replace
“VALSUM”:“\d*.\d*” does not work
Please help
Paul -
@Patrick-Huebgen6
Good attempt. As you say your find regex worked. Unfortunately you cannot use the same type of information in the replace string.May I suggest you read
https://notepad-plus-plus.org/community/topic/15765/faq-desk-where-to-find-regex-documentation
for good documentation on how a regex works. I have tried looking for good information on the replace field, but most concentrate on the Find field so you might need to look quite hard. If I find one i will post back.In the meantime use the following:
Find What:(VALSUM":"\d*),(\d*)
Replace with:\1\.\2
You will see I put brackets around 2 groups in the find window. These are referenced by \1 and \2 in the replace window. As the “.” is special I had to put a ‘delimiter’ before it so that it’s recognised as being the “.” character. I tested it
See if that helps you.
Terry
-
Thank you - worked perfect!