Regex module

replace_all

procedureextension2 overloadsSource

Replaces every match; replacement works as in replace.

Example↗
Regex :: #import "Extensions/Regex";

re, _ := Regex.compile("[0-9]+");
assert(Regex.replace_all(*re, "a1 b22", "#") == "a# b#");
Regex.free_regex(*re);
replace_all :: (re: *Regex, text: string, replacement: string) -> string

Parameters

re: *Regex
text: string
replacement: string

Returns

string
replace_all :: ($R: Type, text: string, replacement: string) -> string

Replaces every match of the static pattern.

Parameters

$R: Type
text: string
replacement: string

Returns

string
Example↗
Regex :: #import "Extensions/Regex";
Digits :: Regex.Static("[0-9]+");

assert(Regex.replace_all(Digits, "1 2", "#") == "# #");

See also