// 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"\b[A-Fa-f0-9]{64}\b").unwrap();
let string = "MD5 ed076287532e86365e841e92bfc50d8c
SHA1 2ef7bde608ce5404e97d5f042f95f89f1c232871
SHA256 7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069
ssdeep3:aBn:aB
File size 12 bytes ( 12 bytes )
File type Text
Magic literalASCII text, with no line terminators
TrID Unknown!
";
// 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/