Lines Matching refs:pattern
170 def match(pattern, string, flags=0): argument
173 return _compile(pattern, flags).match(string)
175 def fullmatch(pattern, string, flags=0): argument
178 return _compile(pattern, flags).fullmatch(string)
180 def search(pattern, string, flags=0): argument
183 return _compile(pattern, flags).search(string)
185 def sub(pattern, repl, string, count=0, flags=0): argument
192 return _compile(pattern, flags).sub(repl, string, count)
194 def subn(pattern, repl, string, count=0, flags=0): argument
203 return _compile(pattern, flags).subn(repl, string, count)
205 def split(pattern, string, maxsplit=0, flags=0): argument
213 return _compile(pattern, flags).split(string, maxsplit)
215 def findall(pattern, string, flags=0): argument
223 return _compile(pattern, flags).findall(string)
225 def finditer(pattern, string, flags=0): argument
230 return _compile(pattern, flags).finditer(string)
232 def compile(pattern, flags=0): argument
234 return _compile(pattern, flags)
241 def template(pattern, flags=0): argument
243 return _compile(pattern, flags|T)
252 def escape(pattern): argument
256 if isinstance(pattern, str):
257 return pattern.translate(_special_chars_map)
259 pattern = str(pattern, 'latin1')
260 return pattern.translate(_special_chars_map).encode('latin1')
271 def _compile(pattern, flags): argument
276 return _cache[type(pattern), pattern, flags]
279 if isinstance(pattern, Pattern):
283 return pattern
284 if not sre_compile.isstring(pattern):
286 p = sre_compile.compile(pattern, flags)
294 _cache[type(pattern), pattern, flags] = p
298 def _compile_repl(repl, pattern): argument
300 return sre_parse.parse_template(repl, pattern)
302 def _expand(pattern, match, template): argument
304 template = sre_parse.parse_template(template, pattern)
307 def _subx(pattern, template): argument
309 template = _compile_repl(template, pattern)
322 return _compile, (p.pattern, p.flags)