Conversation
|
I'm curious how hard would that be to add a test that would demonstrate this behavior? (not necessary as prat of this RP)
indeed, it would be nice to double-check (e.g. in playground) if named capture groups are supported! |
Co-authored-by: Alex <bzz@users.noreply.github.com>
Which part of the documentation are you thinking of? If by that you meant the comment you suggested, then yes, I've added it in |
The previous search using
(?<was matching the syntax(?<name>re)which is not a lookbehind. This new check ((?<=or(?<!) is more reliable.Sidenote:
The syntax
(?<name>re)corresponds to a "named & numbered capturing group (submatch)". Looking at RE2's syntax, this syntax doesn't have the mention "UNSUPPORTED", so one must assume that it is supported. However, we currently assume that the similar syntax(?P<name>re)is unsupported, but it also doesn't have the "UNSUPPORTED" mention 🤔.I think what makes it confusing is that RE2 supports named capture group to make it easier to extract the value of the capture afterwards, but there can be no backreference to that group within the regex. Hence, a better approach to look for incompatible syntax would be to look for a backreference to a named capture group such as
\k<name>or\g<name>instead of looking for(?P<name>re)like we do at the moment.