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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -