Given a parser or string, make a parser that returns
    True if the parser matches, False otherwise
342906
def is_present(p):
    
    return lexeme(p).optional().map(lambda v: False if v is None else True)
316683
function matches(str, match) {
    if (Array.isArray(match)) return match.indexOf(str) > -1;
    return match.test(str);
}
134741
def taxamatch(str1, str2, return_boolean = true)
      preparsed_1 = @parser.parse(str1)
      preparsed_2 = @parser.parse(str2)
      match = taxamatch_preparsed(preparsed_1, preparsed_2) rescue nil
      return_boolean ? (!!match && match['match']) : match
    end
273112
def match_check(self, regex, fun):
        '''
        
        '''
        vals = []
        if isinstance(fun, six.string_types):
            fun = [fun]
        for func in fun:
            try:
                if re.match(regex, func):
                    vals.append(True)
                else:
                    vals.append(False)
            except Exception:
                log.error('Invalid regular expression: %s', regex)
        return vals and all(vals)
282341
def accept(self, f, *args):
        """"""
        match = self.match(f, *args)
        if match is None:
            return

        self.tokenizer.skip(len(match.tokens))
        return match
1351095
static Parser<Expression> compare(Parser<Expression> expr) {
    return Parsers.or(
        compare(expr, ">", Op.GT), compare(expr, ">=", Op.GE),
        compare(expr, "<", Op.LT), compare(expr, "<=", Op.LE),
        compare(expr, "=", Op.EQ), compare(expr, "<>", Op.NE),
        nullCheck(expr), like(expr), between(expr));
  }
1235615
def _parse_bool(self, value):
        """"""
        if isinstance(value, string_types):
            return value.strip().lower() in ['true', '1', 't', 'y', 'yes']
        return bool(value)
1312185
public static Boolean matches( String text , String pattern , String escapeChar )
    {
        if (pattern.length() == 0)
            return text.length() == 0 ? Boolean.TRUE : Boolean.FALSE;
        
        int textPos = 0;
        boolean startWithAny = false;
        String separators = "%_";
        if (escapeChar != null)
            separators += escapeChar;
        StringTokenizer st = new StringTokenizer(pattern,separators,true);
        boolean escapeNext = false;
        while (st.hasMoreTokens())
        {
            String subPattern = st.nextToken();
            
            if (escapeChar != null && !escapeNext && subPattern.equals(escapeChar))
            {
                escapeNext = true;
            }
            else
            if (!escapeNext && subPattern.equals("%"))
            {
                startWithAny = true;
            }
            else
            if (!escapeNext && subPattern.equals("_"))
            {
                if (textPos < text.length())
                    textPos++;
                else
                    return Boolean.FALSE;
            }
            else
            {
                if (startWithAny)
                {
                    int matchPos = text.lastIndexOf(subPattern);
                    if (matchPos == -1 || matchPos < textPos) 
                        return Boolean.FALSE;
                    textPos = matchPos + subPattern.length();
                    startWithAny = false;
                }
                else
                {
                    if (!text.startsWith(subPattern,textPos))
                        return Boolean.FALSE;
                    else
                        textPos += subPattern.length();
                }
                escapeNext = false;
            }
        }
        
        return Boolean.TRUE;
    }
1340794
def _exprparser(
        expr, scope, lang=None, conf=None, configurable=None,
        safe=DEFAULT_SAFE, besteffort=DEFAULT_BESTEFFORT, tostr=False
):
    """"""

    if scope is None:
        scope = {}

    scope.update({
        'configurable': configurable,
        'conf': conf
    })

    expr = REGEX_EXPR_R.sub(
        _refrepl(
            configurable=configurable, conf=conf, safe=safe, scope=scope,
            besteffort=besteffort
        ), expr
    )

    result = resolve(
        expr=expr, name=lang, safe=safe, scope=scope, tostr=tostr,
        besteffort=besteffort
    )

    return result
594910
def bool_from_string(value):
    
    if isinstance(value, six.string_types):
        value = six.text_type(value)
    else:
        msg = "Unable to interpret non-string value '%s' as boolean" % (value)
        raise ValueError(msg)

    value = value.strip().lower()

    if value in ['y', 'yes', 'true', 't', 'on']:
        return True
    elif value in ['n', 'no', 'false', 'f', 'off']:
        return False

    msg = "Unable to interpret string value '%s' as boolean" % (value)
    raise ValueError(msg)
498319
def match(self, string):
        """"""
        if self.casesensitive:
            return fnmatch.fnmatch(string, self.pattern)
        else:
            return fnmatch.fnmatch(string.lower(), self.pattern.lower())
132313
def ismatch(text, pattern):
    """"""

    if hasattr(pattern, 'search'):
        return pattern.search(text) is not None
    else:
        return pattern in text if Config.options.case_sensitive \
            else pattern.lower() in text.lower()
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;
    }
251159
def _is_pattern_match(re_pattern, s):
    """"""
    match = re.match(re_pattern, s, re.I)
    return match.group() == s if match else False
1164207
def parse(cls, parser, text, pos):
        """"""
        match = cls.regex.match(text)
        if match:
            # Check if match is is not in the grammar of the specific keyword class.
            if match.group(0).lower() not in cls.grammar:
                result = text, SyntaxError(repr(match.group(0)) + " is not a member of " + repr(cls.grammar))
            else:
                result = text[len(match.group(0)):], cls(match.group(0))
        else:
            result = text, SyntaxError("expecting " + repr(cls.__name__))
        return result
626682
def match_string(self, stype):
        """"""

        return not (stype - self.string_types) or bool(stype & self.wild_string_types)
890795
public static boolean matchesAny(String str, List<String> regexes) {
        return matchesAny(str, regexes, true);
    }