Skip to main content

replace_all

Function replace_all 

Source
pub fn replace_all(
    pattern: &str,
    replacement: impl AsRef<str>,
    subject: impl AsRef<str>,
) -> String
Expand description

Replaces every match of pattern (a Rust regex-syntax pattern - larust-convert is responsible for translating PHP’s PCRE delimiter/ flag syntax into this form before ever generating a call here) in subject with replacement, which may use $1-style backreferences exactly like PHP’s own preg_replace replacement string. replacement/subject accept both String and &str so the converter’s own translated sub-expressions (a string literal, or a format!(...)-produced String from a .-concatenation) both work as call-site arguments without the converter needing to know which shape it produced.