// 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)(?<=<span>)(.|\n)*?(?=<\/span>)").unwrap();
let string = "<span>
Do not use hard returns to break lines; use the word wrap feature.
</span>
<span>
The
<strong>abstract paragraph</strong>
cannot exceed 250 words. A maximum of 2 tables and/or figures are acceptable. Deduct 50 words from the maximum word count for each included table or figure. Figures
should be no larger than 3.5 inches wide by 4.0 inches high, legible at these dimensions, and cropped to eliminate extra white space. Tables must fit and be legible
within a 3.5 inch column.
</span>";
// 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/