How to remove square brackets in string using regex?

javascript, regex

Solution

Use this regular expression to match square brackets or single quotes:

/[\[\]']+/g

Replace with the empty string.

console.log("['abc','xyz']".replace(/[\[\]']+/g,''));

Problem

`['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 `""`.

Original source