// 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)^(?!.*\bDocuments\b).*\bDownloading view page:(?!\S).*$").unwrap();
let string = "2/27/2020 7:00:43 PM 138 (6036) Downloading view page: /personal/test/Documents/Forms/All.aspx...
2/27/2020 7:00:43 PM 138 (6036) Downloading page WebParts...
2/27/2020 7:00:44 PM 138 (6036) Downloading page web parts completed. 1 web parts successfully downloaded.
2/27/2020 7:00:44 PM 138 (6036) Downloading page content...
2/27/2020 7:00:44 PM 138 (6036) Restarting from position 8312...
2/27/2020 7:00:44 PM 138 (6036) Error: error
double double
2/27/2020 7:00:43 PM 138 (6036) Downloading view page: /personal/test/sdadasda/Forms/All.aspx...
2/27/2020 7:00:44 PM 138 (6036) Error: Unspecified error
2/27/2020 7:00:43 PM 138 (6036) Downloading view page: /personal/test/21312332131/Forms/All.aspx...
2/27/2020 7:00:43 PM 138 (6036) Downloading view page: /personal/test/123/Forms/All.aspx...
2/27/2020 7:00:43 PM 138 (6036) Downloading view page: /personal/test/123/Forms/All.aspx...
2/27/2020 7:00:43 PM 138 (6036) Downloading view page: /personal/test/Documeents/Forms/All.aspx...
2/27/2020 7:00:43 PM 138 (6036) Downloading view page: /personal/test/wr/Forms/All.aspx...";
// 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/