Replaces the first limit matches (all of them when limit < 0).
- replacement: the new text;
$1or${1}stands for a group and$nameor${name}for a named one. - limit: how many matches to replace. Negative replaces all of them.
replace_n :: (
re: *Regex,
text: string,
replacement: string,
limit: int
) -> string
Replaces the first limit matches (all of them when limit < 0).
Parameters
- re: *Regex
- text: string
- replacement: string
- the new text;
$1or${1}stands for a group and$nameor${name}for a named one. - limit: int
- how many matches to replace. Negative replaces all of them.
Returns
- string
replace_n :: ($R: Type, text: string, replacement: string, limit: int) -> string
Parameters
- $R: Type
- text: string
- replacement: string
- limit: int
Returns
- string