示例#1
0
    def subn(self, repl, string, count=0, pos=0, endpos=-1):
        if callable(repl):

            def repl(m, r=repl):
                return r(SRE_Match(m))

        return Regexp.subn(self, repl, string, count, pos, endpos)
示例#2
0
 def findall(self, string, pos=0, endpos=-1):
     return list(Regexp.findstrings(self, string, pos, endpos))
示例#3
0
 def finditer(self, string, pos=0, endpos=-1):
     for match in Regexp.find(self, string, pos, endpos):
         yield SRE_Match(match)
示例#4
0
 def split(self, string, maxsplit=0, pos=0, endpos=-1):
     return Regexp.split(self, string, maxsplit, pos, endpos, True)
示例#5
0
 def subn(self, repl, string, count=0, pos=0, endpos=-1):
     if callable(repl):
         def repl(m, r=repl):
             return r(SRE_Match(m))
     return Regexp.subn(self, repl, string, count, pos, endpos)
示例#6
0
 def search(self, string, pos=0, endpos=-1):
     rv = Regexp.search(self, string, pos, endpos)
     if rv is not None:
         return SRE_Match(rv)
示例#7
0
 def findall(self, string, pos=0, endpos=-1):
     return list(Regexp.findstrings(self, string, pos, endpos))
示例#8
0
 def finditer(self, string, pos=0, endpos=-1):
     for match in Regexp.find(self, string, pos, endpos):
         yield SRE_Match(match)
示例#9
0
 def split(self, string, maxsplit=0, pos=0, endpos=-1):
     return Regexp.split(self, string, maxsplit, pos, endpos, True)
示例#10
0
 def search(self, string, pos=0, endpos=-1):
     rv = Regexp.search(self, string, pos, endpos)
     if rv is not None:
         return SRE_Match(rv)