javascript - jQuery replace ],[ with comma -


i have string :

[[{"en":"search\r\n","fr":"chercher","it":"cercare"}],[{"en":"more information:","fr":"plus d'inforamtion:","it":"informazioni:"}],[{"en":"why choose ?","fr":"pourquoi nous choisir ?","it":"perché scegliere noi?"}],[{"en":"here main values lead choose elgatek project:","fr":"voici les principales valeurs qui vous amèneront à choisir elgatek pour votre projet informatique :","it":"i valori chiave che portano scegliere elgatek per il vostro progetto it:"}],[{"en":"creativity & innovation","fr":"crÉativitÉ & innovation","it":"creatività e innovazione"}] 

i want replace occurrence part string ],[ comma. tried str.replace('],[',',') works on first occurrence. please help.

your string should replace this:

var str = '[[{"en":"search\r\n","fr":"chercher","it":"cercare"}],[{"en":"more information:","fr":"plus d\'inforamtion:","it":"informazioni:"}],[{"en":"why choose ?","fr":"pourquoi nous choisir ?","it":"perché scegliere noi?"}],[{"en":"here main values lead choose elgatek project:","fr":"voici les principales valeurs qui vous amèneront à choisir elgatek pour votre projet informatique :","it":"i valori chiave che portano scegliere elgatek per il vostro progetto it:"}],[{"en":"creativity & innovation","fr":"crÉativitÉ & innovation","it":"creatività e innovazione"}]]';    console.log(str.replace(/\[\{/g, '{').replace(/\}\]/g, '}'));


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -