MatchResult support for named groups
Cay Horstmann
cay.horstmann at gmail.com
Wed Dec 2 10:53:44 UTC 2020
Hello, I'd like to raise awareness for
https://bugs.openjdk.java.net/browse/JDK-8180352
https://bugs.openjdk.java.net/browse/JDK-8072984
https://bugs.openjdk.java.net/browse/JDK-8065554
These all ask for MatchResult.group(String name). What they don't
mention is that this is more urgent in light of the methods
Stream<MatchResult> Matcher.results() //
https://bugs.openjdk.java.net/browse/JDK-8071479
Stream<MatchResult> Scanner.findAll(Pattern pattern) //
https://bugs.openjdk.java.net/browse/JDK-8072722
In particular, Matcher.results() seems a cleaner way of collecting match
results than calling while (matcher.find()).
But then MatchResult needs to support the same queries that Matcher
provides. I believe the only missing one is group(String name).
Cheers,
Cay
NB. There are related requests that ask for finding group names in
patterns, or for correlating group names and numbers. I have formed no
opinion on their merits.
--
Cay S. Horstmann | http://horstmann.com | mailto:cay at horstmann.com
More information about the core-libs-dev
mailing list