I need to replace the "[
by [
and ]"
by ]
combinations everytime found in this string.
I tried this but it doesn't work
var myString = myString .replace(/]"/i, /]/);
myVar = myVar.replace( /\\]"/g, "]").replace( /"\\[/g, "[")
I can assume that you want to convert/format some kind of string to an object, You might take advantage of JSON.parse()
function. See documentation here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.