Return value of regex match for the specified group
193756
def get_group_value(self, token, match):
        """"""
        try:
            value = match.group('{}_{}'.format(token.name, self.group))
        except IndexError:
            value = ''
        return self.func(value) if callable(self.func) else value
251159
def _is_pattern_match(re_pattern, s):
    """"""
    match = re.match(re_pattern, s, re.I)
    return match.group() == s if match else False
958707
def _matchPattern(regExp, string):
        
        match = regExp.match(string)
        if match is not None and match.group(0):
            return match.group(0), (match.group(0), ) + match.groups()
        else:
            return None, None
893493
def regex_matcher(regex_pat):
    
    if isinstance(regex_pat, str):
        regex_pat = re.compile(regex_pat)

    def f(inp_str, pos):
        m = regex_pat.match(inp_str, pos)
        return m.group() if m else None

    return f
72306
private static boolean matchRuleRegex(String regex, String value) {

        if (value == null) {
            value = "";
        }

        if (regex == null) {
            return true;
        }
        if ((regex.length() > 0) && (regex.charAt(0) == '!')) {
            return !value.matches(regex.substring(1));
        } else {
            return value.matches(regex);
        }
    }
649643
def match(pattern, data, **parse_kwargs):
    """"""
    return [m.value for m in parse(pattern, **parse_kwargs).find(data)]
882304
def match(self, item):
        
        val = (getattr(item, self._name) or '').lower()
        result = self._matcher(val) if self._is_regex else self._matcher(val, item)
        if 0:
            log.debug("%r for %r ~ %r, name %r, item %r" % (
                result, val, self._value, self._name, item))
        return result
916197
public static <T extends Collection<String>> T findAll(String regex, CharSequence content, int group, T collection) {
		if (null == regex) {
			return collection;
		}

		return findAll(Pattern.compile(regex, Pattern.DOTALL), content, group, collection);
	}
637896
def re_filter(text, regexps):
    """"""
    if not regexps:
        return text

    matched_text = []
    compiled_regexps = [re.compile(x) for x in regexps]
    for line in text:
        if line in matched_text:
            continue

        for regexp in compiled_regexps:
            found = regexp.search(line)
            if found and found.group():
                matched_text.append(line)

    return matched_text or text
713302
def email_match(string):
    """"""
    m = re.match(email_pattern, string)
    if m:
        # print('Match success: %s' % m.string)
        return m.groups()[0], m.groups()[2]
    else:
        # print('Match failed: %s' % string)
        return None
319435
def regex_query(expression):
    """"""
    def _regex(index, expression=expression):
        """Return store key for documents that satisfy expression."""
        pattern = re.compile(expression)
        return [
            store_key
            for value, store_keys
            in index.get_index().items()
            if (isinstance(value, six.string_types)
                and re.match(pattern, value))
            for store_key in store_keys
        ]

    return _regex
1049866
def _groups_or_na_fun(regex):
    """"""
    if regex.groups == 0:
        raise ValueError("pattern contains no capture groups")
    empty_row = [np.nan] * regex.groups

    def f(x):
        if not isinstance(x, str):
            return empty_row
        m = regex.search(x)
        if m:
            return [np.nan if item is None else item for item in m.groups()]
        else:
            return empty_row
    return f
550044
function(matches, index, tokens, regexValue) {
      var i = tokens.length;

      while (--i >= 0) {
        var token = tokens[i];
        var type = token.type;

        if (type === _Comment ||
            type === _WhiteSpace ||
            type === _LineTerminator) {
          continue;
        }

        var value = token.value;
        if (type === _Punctuator) {
          if (value === ')') {
            if (this.isValidRegExpPrefix(tokens, i + 1)) {
              break;
            }
          } else if (regexPrefixRe.test(value)) {
            break;
          }
        } else if ((type === _Keyword && regexPrefixRe.test(value)) ||
                   (type === _Template && value.slice(-2) === '${')) {
          break;
        }

        var parts = regexValue.match(tokenizeNotRegExpRe);
        splice.apply(matches, [index, 1].concat(parts));
        return true;
      }
      return false;
    }
952130
function(regex, text){
    var nextIndex = 0;
    var result = [];

    var execResult;
    while ((execResult = regex.exec(text))!== null) {
        result.push({
            start: execResult.index, 
            matchLength: execResult[0].length});
    }

    return {
        next: function(){
            return nextIndex < result.length ?
                result[nextIndex++] :
                null;
        }
    };
}
341016
def matchiter(r, s, flags=0):
    
    if isinstance(r, basestring):
        r = re.compile(r, flags)
    i = 0
    while s:
        m = r.match(s)
        g = m and m.group(0)
        if not m or not g:
            raise ValueError("{}: {!r}".format(i, s[:50]))
        i += len(g)
        s = s[len(g):]
        yield m
926321
def _process_regex(cls, regex, rflags, state):
        """"""
        if isinstance(regex, Future):
            regex = regex.get()
        return re.compile(regex, rflags).match
1113674
def _get_string_match_value(self, string, string_match_type):
        """"""
        if string_match_type == Type(**get_type_data('EXACT')):
            return string
        elif string_match_type == Type(**get_type_data('IGNORECASE')):
            return re.compile('^' + string, re.I)
        elif string_match_type == Type(**get_type_data('WORD')):
            return re.compile('.*' + string + '.*')
        elif string_match_type == Type(**get_type_data('WORDIGNORECASE')):
            return re.compile('.*' + string + '.*', re.I)