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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -