remove everything within [] /[[^][]*]/g


Im trying to remove everything that is inside this: []
To example [abcd]word[efg] should be word. I tried to replace it like this but its not working for some reason. Does anyone know how to fix that?

string = '[abcd]word[efg]';
string = string.replace(/[[^][]*]/g,"");
console.log(string);

Source: JavaSript – Stack Overflow

November 27, 2021
Category : News
Tags: javascript | regex

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.