def __init__(self, name, expression):
        """
        :param string name: The name of the field to filter on.
        :param string expression: The regular expression to filter with.
        """
        # Immediately try to compile the expression to check it's validity.
        re.compile(expression)
        self.name = name
        self.expression = expression
def __init__ ( self , name , expression ) : re . compile ( expression ) self . name = name self . expression = expression
:param string name: The name of the field to filter on.
        :param string expression: The regular expression to filter with.