// 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"(?ms)\W+注册单位:\W+注册编号/执业印章号:(\W|\d)+注册专业:\W+有效期:\d+年\d+月\d+日").unwrap();
let string = "一级注册建造师
注册单位:
云南移民产业投融资有限公司
注册编号/执业印章号:
云1532018201900531
注册专业:
建筑工程
有效期:
2026年08月23日";
// 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/