// 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 = "听好听的歌
我想听蜻蜓fm郭德纲的相声
我要听蜻蜓fm郭德纲的相声等等等等
蜻蜓的是的是的
听周杰伦的歌
蜻蜓fm于谦的相声
蜻蜓fm的于谦的相声
想听skds的草根创业最好的项目
想听刘德华的歌
我想听于放的相声的地点的电视
想听好听的音乐
想听铁齿铜牙纪晓岚
我想听中国之声
要听圣诞节
听蜻蜓fm
我想听相声
好听的歌
听广播电台
周杰伦的菊花台
听fm
听六千的相
听加快时间打开手机端
听有声书
听音乐
听蜻蜓fm收银员
听歌曲
";
// 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/