def regex(self, expression, ignore_case=False, options=None):
        """ A query to check if a field matches a given regular expression
            :param ignore_case: Whether or not to ignore the case (setting this to True is the same as setting the 'i' option)
            :param options: A string of option characters, as per the MongoDB $regex operator (e.g. "imxs")

            **Example**: ``session.query(Spell).filter(Spells.name.regex(r'^abra[a-z]*cadabra$', ignore_case=True))``

        """
        regex = {'$regex' : expression}
        if options is not None:
            regex['$options'] = options
        if ignore_case:
            regex['$options'] = regex.get('$options', '') + 'i'
        expr = {
            self : regex
        }
        return QueryExpression(expr)
A query to check if a field matches a given regular expression
            :param ignore_case: Whether or not to ignore the case (setting this to True is the same as setting the 'i' option)
            :param options: A string of option characters, as per the MongoDB $regex operator (e.g. "imxs")

            **Example**: ``session.query(Spell).filter(Spells.name.regex(r'^abra[a-z]*cadabra$', ignore_case=True))``