I am converting my custom tokenizer to moo and ran into a problem case:
// a pattern that used to look like this:
'(?<tag>\\$\\w*\\$)[\\s\\S]*?(?:\\k<tag>|$)'
// as regex literal:
/(?<tag>\$\w*\$)[\s\S]*?(?:\k<tag>|$)/
This pattern tries to match Postgres $$ strings, such as:
-- standard && string
$$lorem ipsum dolor$$
-- custom $$ string with tag (fails here)
$example$this example string fails$example$
The pattern normally works by backreferencing the captured tag between the first dollar signs to check if the second pair of dollar signs has the same tag but this breaks without the use of capturing group when lexing with moo.
Any suggestions on how to workaround this limitation ?
I am converting my custom tokenizer to
moo
and ran into a problem case:This pattern tries to match Postgres $$ strings, such as:
The pattern normally works by backreferencing the captured tag between the first dollar signs to check if the second pair of dollar signs has the same tag but this breaks without the use of capturing group when lexing with
moo
.Any suggestions on how to workaround this limitation ?