Missing the right brace
Closed this issue · 1 comments
Spikef commented
Considering this situation:
'foo ${bar} baz ${quux.bbb + "{}"}'.match(/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g)
The matches[1] should be ${quux.bbb + "{}"} but got ${quux.bbb + "{}".
jonschlinkert commented
It's doing that because there is a nested brace set, so the match stops at the first closing brace it finds. Unfortunately, regex is not capable of tracking opening and closing delimiters as you would with a stack in a parser (to learn more about this, see chomsky's hierarchy. Regular expressions are a "Type 3 grammar").