[\'abc\',\'xyz\'] – this string I want turn into abc,xyz using regex in javascript. I want to replace both open close square bracket & single q
[\'abc\',\'xyz\']
abc,xyz
Use this regular expression to match square brackets or single quotes:
/[\[\]']+/g
Replace with the empty string.
"['abc','xyz']".replace(/[\[\]']+/g,'')