// 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"(?mi)(?P<mem_type> \d{4}/\d{4}/\d{4}\s/\d{4})|(certain\s(?P<mem_quality>\w+))").unwrap();
let string = "<Total Slots :>
<8 (4-channel per CPU, 8 DIMM per CPU)>
<Capacity :>
<Maximum up to 1024GB RDIMM>
<Memory Type :>
<fd4 2933/2666/2400 /2133 RDIMM
bbh567 2933/2666/2400 /2133 LRDIMM>
<screen :>
<720>
<color :>
<blue>
<Memory Quality :>
<Certain 3452345tte READ
Non certain 7JJEN232 LREAD>";
// 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/