def set_source(self, space, source, flags): if source is not None: cache = space.fromcache(RegexpCache) self.source = source code, flags, groupcount, groupindex, indexgroup, group_offsets = regexp.compile(cache, source, flags) self.code = code self.flags = flags self.groupcount = groupcount self.groupindex = groupindex self.indexgroup = indexgroup self.group_offsets = group_offsets
def regexp_match(cache, re, string): pos = 0 endpos = len(string) code, flags, _, _, _, _ = regexp.compile(cache, re) return (rsre_core.StrMatchContext(string, pos, endpos, flags), rsre_core.CompiledPattern(code))
def regexp_match(cache, re, string): pos = 0 endpos = len(string) code, flags, _, _, _, _ = regexp.compile(cache, re) return rsre_core.StrMatchContext(code, string, pos, endpos, flags)