def validate_regex(value):
    try:
        return re.compile(value)
    except (re.error, TypeError) as e:
        raise ValidationError("Invalid regex: %s, %s" % (e, value))
dataset/ETHPy150Open dnephin/PyStaticConfiguration/staticconf/validation.py/validate_regex/original