dbleyenda
dbleyenda

Reputation: 35

Sublime text 2: replace text from JSON using regular expression

I've converted an Excel File to JSON using an online web tool. Now, I need help replacing some values from that JSON. I'm using sublime text 2.

{"Time (GMT-04:00)":"2010-07-06 08:30:00","Skin temp - average":"34,2043","Step Counter":172,"Sleep":"0,0","Physical Activity":1,"Energy expenditure":"11,4371","Annotations":"Running"}

Notice that some numbers were converted to string, because of the comma:

"Skin temp - average":"34,2043"

What I need to accomplish is to erase the quotes in all numbers, and to replace , (comma) with . (dot). Is there a way to do that using regular expressions in ST2?

Ex:

"Skin temp - average":34.2043

Thanks in advance for the help.

Upvotes: 2

Views: 1149

Answers (1)

Harry Dobrev
Harry Dobrev

Reputation: 7706

Try to look for:

"(\d+),(\d+)"

and replace it with:

$1.$2

You can use the Ctrl (Cmd) + Alt + f shortcut to Find & Replace in the current file.

Upvotes: 2

Related Questions