Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7032377

Get name of named capturing group from MatchResult

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      linux

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sherman Xueming Shen
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: