I have this regex:
/(\[.*?\])/g Now I want to change that regex to matches everything except current-matches. How can I do that?
For example:
Current regex:
here is some text [anything123][/21something] and here is too [sometext][/afewtext] and here // ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ I want this:
here is some text [anything123][/21something] and here is too [sometext][/afewtext] and here // ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^
replaceto replace the matches.str.replace(/(\[.*?\])/g, '')\[[^\]]+\](?:^|\s)([\w']+)(?!\])\b|(?:^|\s)([\w']+)(?!\])\b. See Javascript Regex for all words not between certain characterstext.split(/\[.*?\]/g)