Lines Matching refs:regex
19 Helper class to simplify regex declaration and usage.
30 Adds a new regex or reuses it from the cache.
32 self.regex = re_cache.get(string, None)
33 if not self.regex:
34 self.regex = re.compile(string, flags=flags)
36 re_cache[string] = self.regex
52 return self.regex.pattern
55 return f're.compile("{self.regex.pattern}")'
63 flags=self.regex.flags | other.regex.flags)
70 self.last_match = self.regex.match(string)
78 self.last_match = self.regex.search(string)
86 return self.regex.findall(string)
93 return self.regex.split(string)
100 return self.regex.sub(sub, string, count=count)
128 https://stackoverflow.com/questions/5454322/python-how-to-match-nested-parentheses-with-regex
149 # match groups, allowing a regex equivalent to:
166 def _search(self, regex, line):
168 Finds paired blocks for a regex that ends with a delimiter.
171 https://stackoverflow.com/questions/5454322/python-how-to-match-nested-parentheses-with-regex
188 for match_re in regex.finditer(line):
218 def search(self, regex, line):
222 It matches a regex that it is followed by a delimiter,
226 for t in self._search(regex, line):
230 def sub(self, regex, sub, line, count=0):
234 It matches a regex that it is followed by a delimiter,
252 for start, end, pos in self._search(regex, line):