cloud-custodian/cloud-custodian · core.py
python logo
def regex_case_sensitive_match(value, regex):
    if not isinstance(value, six.string_types):
        return False
    # Note python 2.5+ internally cache regex
    # would be nice to use re2
    return bool(re.match(regex, value))
Similar code snippets
1.
cloud-custodian/cloud-custodian · core.py
Match rating: 74.73% · See similar code snippets
python logo
def regex_match(value, regex):
    if not isinstance(value, six.string_types):
        return False
    # Note python 2.5+ internally cache regex
    # would be nice to use re2
    return bool(re.match(regex, value, flags=re.IGNORECASE))
2.
lotrekagency/djlotrek · djlotrek_filters.py
Match rating: 65.07% · See similar code snippets
python logo
def regex_match(value, regex):
    pattern = re.compile(regex)
    if pattern.match(value):
        return True
3.
petermelias/valhalla · strings.py
Match rating: 62.49% · See similar code snippets
python logo
def regex(regex, case=False, _value=None, *args, **kwargs):
    if kwargs.get('case'):
        regex = re.compile(regex)
    else:
        regex = re.compile(regex, re.IGNORECASE)

    if not regex.match(_value):
        raise ValidationError('The _value must match the regex %s' % regex)

    return _value
4.
ianmiell/shutit · shutit_util.py
Match rating: 61.89% · See similar code snippets
python logo
def check_regexp(regex):
	if regex is None:
		# Is this ok?
		return True
	try:
		re.compile(regex)
		return True
	except re.error:
		return False
5.
beardsvibe/buildfox · lib_engine.py
Match rating: 60.47% · See similar code snippets
python logo
def eval_filter(self, name, regex_or_value):
		value = self.variables.get(name, "")
		regex = wildcard_regex(regex_or_value)
		if regex:
			return re.match(regex, value)
		else:
			return regex_or_value == value
6.
ausaki/python-validator · fields.py
Match rating: 60.37% · See similar code snippets
python logo
def _match(self, value):
        if self.regex is None:
            return True
        else:
            return self.regex.match(value) is not None
7.
SmartTeleMax/iktomi · convs.py
Match rating: 60.26% · See similar code snippets
python logo
def to_python(self, value):
        # converting
        value = self.clean_value(value)
        if value and self.regex:
            regex = self.regex
            if isinstance(regex, six.string_types):
                regex = re.compile(self.regex, re.U)
            if not regex.match(value):
                error = self.error_regex % {'regex': self.regex}
                raise ValidationError(error)
        return value
8.
estnltk/estnltk · common.py
Match rating: 60.08% · See similar code snippets
python logo
def is_valid_regex(regex):
    """Function for checking a valid regex."""
    if len(regex) == 0:
        return False
    try:
        re.compile(regex)
        return True
    except sre_constants.error:
        return False
9.
xeBuz/Flask-Validator · others.py
Match rating: 59.77% · See similar code snippets
python logo
def check_value(self, value):
        if re.match(self.regex, value):
            return True
        else:
            return False
10.
scrapinghub/adblockparser · parser.py
Match rating: 59.23% · See similar code snippets
python logo
def _url_matches(self, url):
        if self.regex_re is None:
            self.regex_re = re.compile(self.regex)
        return bool(self.regex_re.search(url))