Lines Matching defs:regex
19 Helper class to simplify regex declaration and usage,
30 Adds a new regex or re-use 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
60 flags=self.regex.flags | other.regex.flags)
67 self.last_match = self.regex.match(string)
75 self.last_match = self.regex.search(string)
83 return self.regex.findall(string)
90 return self.regex.split(string)
97 return self.regex.sub(sub, string, count=count)
124 https://stackoverflow.com/questions/5454322/python-how-to-match-nested-parentheses-with-regex
145 # match groups, allowing a regex equivalent to.
162 def _search(self, regex, line):
164 Finds paired blocks for a regex that ends with a delimiter.
167 https://stackoverflow.com/questions/5454322/python-how-to-match-nested-parentheses-with-regex
184 for match_re in regex.finditer(line):
214 def search(self, regex, line):
218 It matches a regex that it is followed by a delimiter,
222 for t in self._search(regex, line):
226 def sub(self, regex, sub, line, count=0):
230 It matches a regex that it is followed by a delimiter,
244 for start, end, pos in self._search(regex, line):