I wrote the below code to replace all }, with ; but only the first ocurance is getting replaced ,other all remains same..
data1 = "latitude:1.9,longitude:103.57},latitude:1.338,longitude:103.1},latitude:1.33,longitude:103.7556}"
var re = '},'
data = data1.replace(re,';')
I am getting the output like
"latitude:1.9,longitude:103.57;latitude:1.338,longitude:103.1},latitude:1.33,longitude:103.7556}"
expected output
"latitude:1.9,longitude:103.57;latitude:1.338,longitude:103.1;latitude:1.33,longitude:103.7556}"