This regex is used to find closing multiline strings, if I interpret its usage correctly.
However: it's not super clear to me how the pattern -- or the subpatterns within it -- work when matching. I think a lot of relates to handling variable/call interpolation syntax (e.g. ${x + 1}).
it
I'm not the best at comprehending regular expressions, but perhaps a short paragraph before the pattern could help to explain how it functions.
Ref:
|
var templateLitReg = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g |
Edit: add code link
This regex is used to find closing multiline strings, if I interpret its usage correctly.
However: it's not super clear to me how the pattern -- or the subpatterns within it -- work when matching. I think a lot of relates to handling variable/call interpolation syntax (e.g.
${x + 1}).it
I'm not the best at comprehending regular expressions, but perhaps a short paragraph before the pattern could help to explain how it functions.
Ref:
eta/src/parse.ts
Line 24 in 78c256c
Edit: add code link