MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / sub

Function sub

tools/python-3.11.9-amd64/Lib/re/__init__.py:178–185  ·  view source on GitHub ↗

Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a string, backslash escapes in it are processed. If it is a callable, it's passed the Match object an

(pattern, repl, string, count=0, flags=0)

Source from the content-addressed store, hash-verified

176 return _compile(pattern, flags).search(string)
177
178def sub(pattern, repl, string, count=0, flags=0):
179 """Return the string obtained by replacing the leftmost
180 non-overlapping occurrences of the pattern in string by the
181 replacement repl. repl can be either a string or a callable;
182 if a string, backslash escapes in it are processed. If it is
183 a callable, it's passed the Match object and must return
184 a replacement string to be used."""
185 return _compile(pattern, flags).sub(repl, string, count)
186
187def subn(pattern, repl, string, count=0, flags=0):
188 """Return a 2-tuple containing (new_string, number).

Callers

nothing calls this directly

Calls 2

_compileFunction · 0.70
subMethod · 0.45

Tested by

no test coverage detected