{ "url": "products/Sensors.html",
"thumbnailUrl":"/images/icons/no_image.png",
"translatedTitle": "sensors",
...
},
...
我想将附加值“localhost:8080”添加到属性“thumbnailUrl”,以.png | jpg等结尾
替换值应为:
{ "url": "products/Sensors.html",
"thumbnailUrl":"localhost:8080/images/icons/no_image.png",
"translatedTitle": "sensors",
...
}
答案 0 :(得分:0)
为什么不这样做 Myobj.thumbnailUrl =" localhost:8080" + myobj.thumbnailUrl;
否则 Mynewstring = myexistingstring.replace(/(thumbnailUrl \":\")/,' $ 1' +' localhost:8080');