def __init__( self, pattern, flags=<NUM_LIT:0>, asGroupList=False, asMatch=False):
super(Regex,self).__init__()<EOL>if isinstance(pattern, basestring):<EOL><INDENT>if not pattern:<EOL><INDENT>warnings.warn("<STR_LIT>",<EOL>SyntaxWarning, stacklevel=<NUM_LIT:2>)<EOL><DEDENT>self.pattern = pattern<EOL>self.flags = flags<EOL>try:<EOL><INDENT>self.re = re.compile(self.pattern, self.flags)<EOL>self.reString = self.pattern<EOL><DEDENT>except sre_constants.error:<EOL><INDENT>warnings.warn("<STR_LIT>" % pattern,<EOL>SyntaxWarning, stacklevel=<NUM_LIT:2>)<EOL>raise<EOL><DEDENT><DEDENT>elif isinstance(pattern, Regex.compiledREtype):<EOL><INDENT>self.re = pattern<EOL>self.pattern =self.reString = str(pattern)<EOL>self.flags = flags<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>self.name = _ustr(self)<EOL>self.errmsg = "<STR_LIT>" + self.name<EOL>self.mayIndexError = False<EOL>self.mayReturnEmpty = True<EOL>self.asGroupList = asGroupList<EOL>self.asMatch = asMatch<EOL>if self.asGroupList:<EOL><INDENT>self.parseImpl = self.parseImplAsGroupList<EOL><DEDENT>if self.asMatch:<EOL><INDENT>self.parseImpl = self.parseImplAsMatch<EOL><DEDENT>
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.