Macro lazy_regex::regex_replace_all
source ยท regex_replace_all!() { /* proc-macro */ }
Expand description
Replaces all non-overlapping matches in the second argument using the replacer given as third argument.
When the replacer is a closure, it is given one or more &str
,
the first one for the whole match and the following ones for
the groups.
Any optional group with no value is replaced with ""
.
Example:
let text = "Foo fuu";
let text = regex_replace_all!(
r#"\bf(?P<suffix>\w+)"#i,
text,
|_, suffix| format!("F<{}>", suffix),
);
assert_eq!(text, "F<oo> F<uu>");