-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
None
A DESCRIPTION OF THE REQUEST :
http://download.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
The new RegExp packages supports named capturing groups through Match.group(String name), which is fine. But it lacks the method to get the name of the group from within the Match(Result).
In my case I'd like to loop through all matches and from within that match, check if there's a named capturing group associated. If so, I'd like to get the name and put the match into an Map<String groupname, String result>.
Would be great to have this enchancements in JDK7.
JUSTIFICATION :
It makes the named capturing groups usefull in a lot more cases.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
MatchResult.getGroupName(); oid.
ACTUAL -
No function available.
CUSTOMER SUBMITTED WORKAROUND :
Having some manual Mapping between the group index and the name to associate.
http://download.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
The new RegExp packages supports named capturing groups through Match.group(String name), which is fine. But it lacks the method to get the name of the group from within the Match(Result).
In my case I'd like to loop through all matches and from within that match, check if there's a named capturing group associated. If so, I'd like to get the name and put the match into an Map<String groupname, String result>.
Would be great to have this enchancements in JDK7.
JUSTIFICATION :
It makes the named capturing groups usefull in a lot more cases.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
MatchResult.getGroupName(); oid.
ACTUAL -
No function available.
CUSTOMER SUBMITTED WORKAROUND :
Having some manual Mapping between the group index and the name to associate.
- duplicates
-
JDK-8249601 Provide public access to java.util.regex.Pattern.namedGroups
- Closed
- relates to
-
JDK-8065554 MatchResult should provide values of named-capturing groups
- Resolved