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#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c# - Making TableLayoutPanel Act Like An HTML Table (Cells That Resize Automatically Around Text) -