// 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)Tornado Warning for\.\.\.(?:\n.*)*?\n\n").unwrap();
let string = "The National Weather Service in Milwaukee/Sullivan has issued a
* Tornado Warning for...
Northwestern Columbia County in south central Wisconsin...
Southwestern Marquette County in south central Wisconsin...
* Until 945 PM CDT.
* At 911 PM CDT, a severe thunderstorm capable of producing a tornado
was located 8 miles east of Wisconsin Dells, moving northeast at 45
mph.
HAZARD...Tornado.
SOURCE...Radar indicated rotation.
IMPACT...Flying debris will be dangerous to those caught without
shelter. Mobile homes will be damaged or destroyed.
Damage to roofs, windows, and vehicles will occur. Tree
damage is likely.
* Locations impacted include...
Packwaukee, Endeavor and Briggsville.";
// 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/