9 ms·
Yeah, sorry I didn't explain tagged template literals, just linked to an example. You could make one called, say, rx for regex. Then rx`${a}|${b}` would
by abecedarius 4y ago
Yeah, sorry I didn't explain tagged template literals, just linked to an example.
You could make one called, say, rx for regex. Then
rx`${a}|${b}`
would evaluate to exactly the same result as a tree constructor call like
regex_or(a, b)
given corresponding definitions of rx and of regex_or. There's never any question of whether a and b are escaped right. So it brings the composability advantage of the library functions you prefer, to people who want to write these concrete-syntax regular expressions that started the whole thread.