Would this be a good way to define a regexp (dulcinea) ?

mario

class regexp(SpecOperator):

    def __init__(self, pattern='[EMAIL PROTECTED]'):
        import re
        self.re = re.compile(pattern)
        self.args =  (self.re,)

    def __call__(self, value):
        try:
            if self.re.match(value):
                return True
            return False
        except TypeError:
            return False

    def __str__(self):
        return "string matching pattern '%s'" % (self.re.pattern)

_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users

Reply via email to