// 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"(https?):\/\/([0-9a-z.\-\/]+)").unwrap();
let string = "<div class=\"filefield-file\"><img class=\"filefield-icon field-icon-application-vnd-ms-excel\" alt=\"application/vnd.ms-excel icon\" src=\"http://uristhome.ru/sites/all/modules/filefield/icons/x-office-spreadsheet.png\"><a href=\"https://uristhome.ru/sites/default/files/doc/ks-6a.xls\" type=\"application/vnd.ms-excel; length=51712\" title=\"ks-6a.xls\">Типовой бланк и форма КС-6а</a></div>
";
// 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/