Match.groups() should return all groups #17643
Labels
area-library
closed-duplicate
Closed in favor of an existing report
library-core
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @jooadam
I’m suprised that there is no direct way to ask for all the capture groups’ content in a Match object.
Currently,
String Match.group(int group)
returns the contents of the designated group, whileList<String> Match.groups(List<int> groupIndices)
returns a list of the contents of the groups given as argument to the method. There is, however, no straightforward way to get the contents of all the groups: omitting the arguments does not check, an empty list yields an empty list, null throws an exception.One is left with
match.groups(new List.generate(match.groupCount, (i) => i + 1))
, which is ridiculous.The text was updated successfully, but these errors were encountered: