-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
The following code compiles, but the group just contains the last capture:
var m: RegexMatch
doAssert "abab".match(re"(?P<foo>ab)(?P<foo>ab)", m)
doAssert m.group("foo") == @[2 .. 3]
doAssert m.group(0) == @[0 .. 1]
doAssert m.group(1) == @[2 .. 3]
So, we can either throw a compile error, same as PCRE, or we can make foo
return both group captures. The latter sounds like a nice feature for expressions like "(?P<foo>ab)|(?P<foo>cd)|(?P<foo>ef)"
.
Metadata
Metadata
Assignees
Labels
No labels