code: public Matcher matcher(MatchResult res, int groupId) {
          Matcher m = new Matcher(this);
          if (res instanceof Matcher) {
              m.setTarget((Matcher) res, groupId);
          } else {
              m.setTarget(res.targetChars(), res.start(groupId) + res.targetStart(), res.length(groupId));
          }
          return m;
      }
docs: Returns a matcher for a match result (in a performance-friendly way).
  <code>groupId</code> parameter specifies which group is a target.
  
  @param groupId which group is a target; either positive integer(group id), or one of MatchResult.MATCH,MatchResult.PREFIX,MatchResult.SUFFIX,MatchResult.TARGET.