Hello, @flammable and All,
First, I would advice you to fully read this interesting FAQ post below, which explains to prefer the use of a JSON parser ( instead of regexes ) for such problems :
Oh,…, by moving to your post, I just see the @mark-olson’s reply which explains a straight solution, based on the JsonTools plugin ;-))
However, I also succeeded to find out a regex way to do it !
So, given your INPUT text, below, in a new tab :
"water": { "DisplayName": "Water", "Skin": 0, "Image": "water.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 5000, "SellPrice": 0, "Currency": "eco" }, "healingtea.advanced": { "DisplayName": "default", "Skin": 0, "Image": "healingtea.advanced.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 500, "SellPrice": 0, "Currency": "eco" },Open the Replace dialog ( Ctrl + H )
Untick all box options
SEARCH (?-is)^\x20+"Image":\x20"\K
REPLACE https://www.example\.com/example2/
Check the Wrap around option
Click, once, on the Replace All button ( NOT the Replace button ! )
You should get this OUTPUT text :
"water": { "DisplayName": "Water", "Skin": 0, "Image": "https://www.example.com/example2/water.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 5000, "SellPrice": 0, "Currency": "eco" }, "healingtea.advanced": { "DisplayName": "default", "Skin": 0, "Image": "https://www.example.com/example2/healingtea.advanced.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 500, "SellPrice": 0, "Currency": "eco" },Now with the following regex S/R, we’ll change any dot character, not followed by the string png", at end of line, with a dash char :
SEARCH (?-si)(?:^\x20+"Image":\x20"https://www.example.com/example2/|(?!\A)\G).*?\K\.(?!png",$)
REPLACE -
Just follow, exactly, the same other points of the previous S/R !
You should get your expected OUTPUT text :
"water": { "DisplayName": "Water", "Skin": 0, "Image": "https://www.example.com/example2/water.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 5000, "SellPrice": 0, "Currency": "eco" }, "healingtea.advanced": { "DisplayName": "default", "Skin": 0, "Image": "https://www.example.com/example2/healingtea-advanced.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 500, "SellPrice": 0, "Currency": "eco" },BR
guy038