// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)\b(YMS\-15|MSM\-10|YMS\-14|MAN\-07|MSN\-02|MSM\-07S|MA\-05|MSM\-07|MSM\-04F|MSM\-03|MS\-X16|MAN\-03|MS\-X10|MS\-14A|MS\-R09|MS\-06F|MS\-14|MS\-11|MS\-09R|MS\-09|MS\-07B|MS\-07|MS\-06S|MS\-06J|MS\-06|MSN\-X2|MS\-05B|MAX\-03|MS\-14S|MAN\-X3|MAN\-08|MA\-08|MA\-05H|MAN\-X8|MA\-04X|MSM\-04|MAM\-07|YMS\-07B)\b").unwrap();
let string = "MAM-07
YMS-07B
YMS-07 -- 無効なモデル名に部分マッチしなくなった";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/