Hello, @silvermew22, @mkupper, @mark-olson and All,
I suppose that the following version should be better as it reduces the replacements to the syntaxes like 50.880001068115234 or 50.5 only !
SEARCH (?-i)((?<!\\)"X"\s*:\s*50\.)(?!0,)\d+
Replace ${1}0
Now, in order to only get modifications, in the right "Events" array, we could use this version :
SEARCH (?-i)(?:"Events"|(?!\A)\G)(?s:(?!\x5D).)*?\K((?<!\\)"X"\s*:\s*50\.)(?!0,)\d+
REPLACE ${1}0
So :
Paste your
JSON file OR the example, below, in a
new tab
{
"Tests": [
{
"Delta": 0,
"EventType": "MouseDown",
"Timestamp": 603,
"X": 50.0,
"Y": 79.61000061035056
},
{
"Delta": 0,
"EventType": "MouseMove",
"Timestamp": 891,
"X": 50.880001068115234,
"Y": 41.540000915527344
},
{
"Delta": 0,
"EventType": "MouseMove",
"Timestamp": 939,
"X": 50.5,
"Y": 36.61000061035056
},
]
},
{
"Events": [
{
"Delta": 0,
"EventType": "MouseDown",
"Timestamp": 603,
"X": 50.0,
"Y": 79.61000061035056
},
{
"Delta": 0,
"EventType": "MouseMove",
"Timestamp": 683,
"X": 50.0,
"Y": 79.50000213623050
},
{
"Delta": 0,
"EventType": "MouseMove",
"Timestamp": 891,
"X": 50.880001068115234,
"Y": 41.540000915527344
},
{
"Delta": 0,
"EventType": "MouseMove",
"Timestamp": 939,
"X": 50.5,
"Y": 36.61000061035056
},
{
"Delta": 0,
"EventType": "MouseUp",
"Timestamp": 1950,
"X": 50.95000076293945,
"Y": 6.659999850412109
}
]
}
Move the caret to the very beginning of the file ( Very IMPORTANT )
Open the Replace dialog ( Ctrl + H )
Untick all the box options
Click once on the Replace All button
Voila ! There were only 3 replacements in the unique "Events" array… and none in the "Tests" array !
Best Regards,
guy038