// 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)ます|した|表現|彼").unwrap();
let string = "ある口の利けない人が歯ブラシを購入しようとしています。彼は、歯を磨くジェスチャーをして、店員にうまく伝える事ができたので目的の歯ブラシを買えました。次に、ある目の見えない人が、自分の目を隠すためにサングラスを買おうとしています。
問6 さて彼はどんな風に表現をすればうまく店員に伝わると思いますか。
目が見えない人にはもちろんステッキがあります。手を上げて、店員さんの注目を引きます。そして、店員さんがくる時直接サングラスが買いたいと言ってもいいです。
もしジェスチャーをしたいならば、目を閉じてまま眼鏡のジェスチャーをしてもいいです。
";
// 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/