📜  rust 简单的搜索和替换正则表达式 - Rust 代码示例

📅  最后修改于: 2022-03-11 14:49:25.189000             🧑  作者: Mango

代码示例1
use regex::Regex;

fn word_replace(str: &str) -> String {
    let re = Regex::new(r"word").unwrap();
    re.replace_all(&str, "****").to_string()
}
// Find each instance of "word" in a string and replace with something else.