Macro lazy_regex::bytes_regex_replace_all
source ยท bytes_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 = b"Foo fuu";
let text = bytes_regex_replace_all!(
r#"\bf(?P<suffix>\w+)"#i,
text,
b"H",
);
assert_eq!(text, "H H".as_bytes());