Returns the specific submatch based on index (1-based).  This is
equivalent to Expect's <code>expect_out(x,string)</code>.
176792
public String getMatch(int groupnum) {
        if (groupnum == 0)
            return getMatch();
        else if (groupnum > groups.size())
            return null;

        return (String) groups.get(groupnum - 1);
    }
44911
public ResultMatcher isStringEqualTo(final String expected) {
        return new AbstractResultMatcher(path, configuration) {
            public void doMatch(Object actual) {
                isString(actual);
                Node node = getNode(actual);
                if (!node.asText().equals(expected)) {
                    failWithMessage("Node \"" + path + "\" is not equal to \"" + expected + "\".");
                }
            }
        };

    }
302289
private static int jsSplitMatch(String stringValue, int startIndex,
                                  String separator) {

    if (startIndex + separator.length() > stringValue.length()) {
      return -1;
    }

    int matchIndex = stringValue.indexOf(separator, startIndex);

    if (matchIndex < 0) {
      return -1;
    }

    return matchIndex;
  }
728936
public Expression2 getSubexpression(int index) {
    Preconditions.checkArgument(index < size);
    if (index == 0) {
      return this;
    } else {
      int[] parts = findSubexpression(index);
      return subexpressions.get(parts[0]).getSubexpression(parts[1]);
    }
  }
460727
T get(long index) {
        checkRange(index);

        if (checkSubRange(index)) {
            // cannot exceed Integer.MAX_VALUE (checked by checkSubRange)
            return subList.get((int) (index - subListOffset));
        }
        return null;
    }
1092380
def __get_match_result(self, ret, ret2):
        
        if self.another_compare == "__MATCH_AND__":
            return ret and ret2
        elif self.another_compare == "__MATCH_OR__":
            return ret or ret2
        return ret
1260603
public final T substr(int beginIndex) {
        if (beginIndex < 0) {
            throw new StringIndexOutOfBoundsException(beginIndex);
        }
        return (beginIndex == 0) ? me() : substr(beginIndex, size());
    }
587543
function lookupSpecMatch(lookup, spec) {
  // Direct match
  if (lookup[spec]) {
    return lookup[spec];
  }

  // Close match
  var shortSpec = spec.replace(/@\D/g,'@');
  if (lookup[shortSpec]) {
    return lookup[shortSpec];
  }

  // Check for Semver valid match
  var lastIndex = spec.lastIndexOf('@');
  var myName = spec.substring(0, lastIndex);
  var myVersion = spec.substring(lastIndex + 1);
  for(var k in lookup) {
    lastIndex = k.lastIndexOf('@');
    var yourName = k.substring(0, lastIndex);
    var yourVersion = k.substring(lastIndex + 1);
    if (myName == yourName && semver.valid(yourVersion) && semver.satisfies(yourVersion, myVersion)) {
      return lookup[k];
    }
  }
  return undefined;
}
149022
def subat(orig, index, replace):
    
    return "".join([(orig[x] if x != index else replace) for x in range(len(orig))])
1112698
function _getSubstring (str, index) {
  if (!isIndex(index)) {
    // TODO: better error message
    throw new TypeError('Index expected')
  }
  if (index.size().length !== 1) {
    throw new DimensionError(index.size().length, 1)
  }

  // validate whether the range is out of range
  const strLen = str.length
  validateIndex(index.min()[0], strLen)
  validateIndex(index.max()[0], strLen)

  const range = index.dimension(0)

  let substr = ''
  range.forEach(function (v) {
    substr += str.charAt(v)
  })

  return substr
}
463910
def sub_slots(x,match_fn,path=(),arr=None,match=False,recurse_into_matches=True):
  
  # todo: rename match to topmatch for clarity
  # todo: profiling suggests this getattr-heavy recursive process is the next bottleneck
  if arr is None: arr=[]
  if match and match_fn(x):
    arr.append(path)
    if not recurse_into_matches:
      return arr
  if isinstance(x, PathTree):
    for attr in x.ATTRS:
      val = getattr(x,attr)
      if attr in x.VARLEN:
        for i,elt in enumerate(val or ()):
          nextpath = path + ((attr,i),)
          sub_slots(elt,match_fn,nextpath,arr,True,recurse_into_matches)
      else:
        nextpath = path + (attr,)
        sub_slots(val,match_fn,nextpath,arr,True,recurse_into_matches)
  return arr
750131
def index(self, sub, *args):
        
        pos = self.find(sub, *args)
        if pos == -1:
            raise ValueError('substring not found')
        return pos
740637
def comparable(self):
    """"""
    sub_comparable_string = 'location: {0:s}'.format(self.location)
    return self._GetComparable(sub_comparable_string=sub_comparable_string)
1332178
private static boolean isMatch(List<ValueMatcher> matchers, int index, int value) {
		return (matchers.size() > index) ? matchers.get(index).match(value) : true;
	}
1002781
def _match_stmt(ctx, stmt, specs, canonical):
    
    (spec, canspec) = specs
    i = 0
    while i < len(spec):
        (keywd, occurance) = spec[i]
        if keywd == '$any':
            return (spec, canspec)
        if keywd == '$1.1':
            (keywd, occurance) = occurance
            if (stmt.i_module.i_version == '1' and
                keywd == stmt.keyword):
                return None
        if keywd == stmt.keyword:
            if occurance == '1' or occurance == '?':
                # consume this match
                if canonical == True:
                    return (spec[i+1:], spec_del_kwd(keywd, canspec))
                else:
                    return (spec[:i] + spec[i+1:], canspec)
            if occurance == '+':
                # mark that we have found the one that was needed
                c = (keywd, '*')
                if canonical == True:
                    return ([c] + spec[i+1:], canspec)
                else:
                    return (spec[:i] + [c] + spec[i+1:], canspec)
            else:
                # occurane == '*'
                if canonical == True:
                    return (spec[i:], canspec)
                else:
                    return (spec, canspec)
        elif keywd == '$choice':
            cases = occurance
            j = 0
            while j < len(cases):
                # check if this alternative matches - check for a
                # match with each optional keyword
                save_errors = copy.copy(ctx.errors)
                if spec == top_stmts:
                    match_res = _match_stmt(ctx, stmt, (cases[j],[]), False)
                else:
                    match_res = _match_stmt(ctx, stmt, (cases[j],cases[j]),
                                            canonical)
                if match_res != None:
                    # this case branch matched, use it.
                    # remove the choice and add res to the spec.
                    nspec = spec[:i] + match_res[0] + spec[i+1:]
                    return (nspec, canspec)
                # we must not report errors on non-matching branches
                ctx.errors = save_errors
                j += 1
        elif keywd == '$interleave':
            cspec = occurance
            match_res = _match_stmt(ctx, stmt, (cspec, cspec), canonical)
            if match_res != None:
                # we got a match
                return (spec, canspec)
        elif util.is_prefixed(stmt.keyword):
            # allow extension statements mixed with these
            # set canonical to False in this call to just remove the
            # matching stmt from the spec
            match_res = _match_stmt(ctx, stmt, (spec[i+1:], canspec), False)
            if match_res != None:
                return (spec[:i+1] + match_res[0], canspec)
            else:
                return None
        elif keywd == '$cut':
            # any non-optional statements left are errors
            for (keywd, occurance) in spec[:i]:
                if occurance == '1' or occurance == '+':
                    error.err_add(ctx.errors, stmt.pos, 'UNEXPECTED_KEYWORD_1',
                                  (util.keyword_to_str(stmt.raw_keyword),
                                   util.keyword_to_str(keywd)))
            # consume them so we don't report the same error again
            spec = spec[i:]
            i = 0
        elif canonical == True:
            if occurance == '1' or occurance == '+':
                error.err_add(ctx.errors, stmt.pos,
                              'UNEXPECTED_KEYWORD_CANONICAL_1',
                              (util.keyword_to_str(stmt.raw_keyword),
                               util.keyword_to_str(keywd)))
                # consume it so we don't report the same error again
                spec = spec[i:]
                i = 0
        # check next in spec
        i += 1
    return None
506078
def match_main(self, text, pattern, loc):
    
    # Check for null inputs.
    if text == None or pattern == None:
      raise ValueError("Null inputs. (match_main)")

    loc = max(0, min(loc, len(text)))
    if text == pattern:
      # Shortcut (potentially not guaranteed by the algorithm)
      return 0
    elif not text:
      # Nothing to match.
      return -1
    elif text[loc:loc + len(pattern)] == pattern:
      # Perfect match at the perfect spot!  (Includes case of null pattern)
      return loc
    else:
      # Do a fuzzy compare.
      match = self.match_bitap(text, pattern, loc)
      return match
265342
def next(self, match, predicate=None, index=None):
        
        current = match.start + 1
        while current <= self._max_end:
            next_matches = self.starting(current)
            if next_matches:
                return filter_index(next_matches, predicate, index)
            current += 1
        return filter_index(_BaseMatches._base(), predicate, index)