def _compile(self, p):
        """
        Recursively compiles the regexs in the pattern (p).
        """
        if self._is_value_filter(p) and p[0] == '=~':
            try:
                p[2] = re.compile(p[2])
            except:  # Python doesn't document exactly what exceptions re.compile throws
                raise ValueError('Bad regex - {0}'.format(p[2]))
        elif self._is_operator(p):
            for operator_or_filter in (p[1] if p[0] != '!' else [p[1]]):
                self._compile(operator_or_filter)