match-recursive
Recursive regular expression matching for nested constructs
Heavily inspired by Steven Leviathan's article.
Ever wanted to match all contents between braces in a string, only to run into trouble with unmatched braces? Here's the solution!
Each [balanced, so this ']' bracket is ignored] subgroup will be matched recursively, ((2 + 2)*2)^2 will also match the outer group '(2 + 2)*2'. A second invocation will match the inner group '2+2'.
npm install match-recursive
Usage examples
var matchRecursive = ; ; // returns: []; // returns: ["t(e)s", ""]; // returns: ["e"]; // returns: ["e"]; // returns: ["<e>"]; // returns: ["t<e<|s|>t"]