['abc','xyz'] – this string I want turn into abc,xyz using regex in javascript. I want to replace both open close square bracket & single quote with empty string ie "".
['abc','xyz']
abc,xyz
""
Use this regular expression to match square brackets or single quotes:
/[[]']+/g
Replace with the empty string.
console.log("['abc','xyz']".replace(/[[]']+/g,''));
1.4m articles
1.4m replys
5 comments
57.0k users