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

Function subn

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

Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that were made. repl can be either a strin

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

Source from the content-addressed store, hash-verified

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).
189 new_string is the string obtained by replacing the leftmost
190 non-overlapping occurrences of the pattern in the source
191 string by the replacement repl. number is the number of
192 substitutions that were made. repl can be either a string or a
193 callable; if a string, backslash escapes in it are processed.
194 If it is a callable, it's passed the Match object and must
195 return a replacement string to be used."""
196 return _compile(pattern, flags).subn(repl, string, count)
197
198def split(pattern, string, maxsplit=0, flags=0):
199 """Split the source string by the occurrences of the pattern,

Callers

nothing calls this directly

Calls 1

_compileFunction · 0.70

Tested by

no test coverage detected