javascript - How to remove square brackets in string using regex? -


['abc','xyz'] – string want turn abc,xyz using regex in javascript. want replace both open close square bracket & single quote empty string ie "".

use regular expression match square brackets or single quotes:

/[\[\]']+/g 

replace empty string.

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

Comments