( self, pattern, flags=0, asGroupList=False, asMatch=False)
The parameters ``pattern`` and ``flags`` are passed
        to the ``re.compile()`` function as-is. See the Python
        `re module <https://docs.python.org/3/library/re.html>`_ module for an
        explanation of the acceptable patterns and flags.
The parameters ``pattern`` and ``flags`` are passed
        to the ``re.compile()`` function as-is. See the Python
        `re module <https://docs.python.org/3/library/re.html>`_ module for an
        explanation of the acceptable patterns and flags.
The parameters pattern and flags are passed to the re . compile () function as - is . See the Python re module <https : // docs . python . org / 3 / library / re . html > _ module for an explanation of the acceptable patterns and flags .
def __init__( self, pattern, flags=0, asGroupList=False, asMatch=False):
        """The parameters ``pattern`` and ``flags`` are passed
        to the ``re.compile()`` function as-is. See the Python
        `re module <https://docs.python.org/3/library/re.html>`_ module for an
        explanation of the acceptable patterns and flags.
        """
        super(Regex,self).__init__()

        if isinstance(pattern, basestring):
            if not pattern:
                warnings.warn("null string passed to Regex; use Empty() instead",
                        SyntaxWarning, stacklevel=2)

            self.pattern = pattern
            self.flags = flags

            try:
                self.re = re.compile(self.pattern, self.flags)
                self.reString = self.pattern
            except sre_constants.error:
                warnings.warn("invalid pattern (%s) passed to Regex" % pattern,
                    SyntaxWarning, stacklevel=2)
                raise

        elif isinstance(pattern, Regex.compiledREtype):
            self.re = pattern
            self.pattern = \
            self.reString = str(pattern)
            self.flags = flags

        else:
            raise ValueError("Regex may only be constructed with a string or a compiled RE object")

        self.name = _ustr(self)
        self.errmsg = "Expected " + self.name
        self.mayIndexError = False
        self.mayReturnEmpty = True
        self.asGroupList = asGroupList
        self.asMatch = asMatch
        if self.asGroupList:
            self.parseImpl = self.parseImplAsGroupList
        if self.asMatch:
            self.parseImpl = self.parseImplAsMatch
def __init__ ( self , pattern , flags = 0 , asGroupList = False , asMatch = False ) : super ( Regex , self ) . __init__ ( ) if isinstance ( pattern , basestring ) : if not pattern : warnings . warn ( "null string passed to Regex; use Empty() instead" , SyntaxWarning , stacklevel = 2 ) self . pattern = pattern self . flags = flags try : self . re = re . compile ( self . pattern , self . flags ) self . reString = self . pattern except sre_constants . error : warnings . warn ( "invalid pattern (%s) passed to Regex" % pattern , SyntaxWarning , stacklevel = 2 ) raise elif isinstance ( pattern , Regex . compiledREtype ) : self . re = pattern self . pattern = self . reString = str ( pattern ) self . flags = flags else : raise ValueError ( "Regex may only be constructed with a string or a compiled RE object" ) self . name = _ustr ( self ) self . errmsg = "Expected " + self . name self . mayIndexError = False self . mayReturnEmpty = True self . asGroupList = asGroupList self . asMatch = asMatch if self . asGroupList : self . parseImpl = self . parseImplAsGroupList if self . asMatch : self . parseImpl = self . parseImplAsMatch