findall(source) > list Return a list of all nonoverlapping matches of the compiled pattern in string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result. Definition at line 465 of file aapre.py. 00465 : """findall(source) > list Return a list of all nonoverlapping matches of the compiled pattern in string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result. """ pos = 0 end = len(source) results = [] match = self.code.match append = results.append while pos <= end: regs = match(source, pos, end, 0) if not regs: break i, j = regs[0] rest = regs[1:] if not rest: gr = source[i:j] elif len(rest) == 1: a, b = rest[0] gr = source[a:b] else: gr = [] for (a, b) in rest: gr.append(source[a:b]) gr = tuple(gr) append(gr) pos = max(j, pos+1) return results # The following 3 functions were contributed by Mike Fletcher, and # allow pickling and unpickling of RegexObject instances. def __getinitargs__(self):
