Vec<u8> で正規表現を使う場合

以下の2パターンがある

正規表現でできること

競プロではだいたい、is_match と replace (replace_all) で事足りるはず。

マッチ判定

let re = Regex::new(r"^<=+>$").unwrap();
let s = "<====>";
let ans = re.is_match(s);

置換

参考: replace の型

pub fn replace<'h, R: Replacer>(
    &self,
    haystack: &'h str,
    rep: R
) -> Cow<'h, str>