// 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)\b(?:BP:?(?:-Sitting)?|Blood Pressure) \d+/\d+(?: mmHg?)?|B/P - (?:Sys|Dias)tolic \d+|(?:Sys|Dias)tolic Blood Pressure \d+ \w+\b").unwrap();
let string = "BP 98/60
BP 108/60
BP 96/60
BP 120/75
Blood Pressure 106/63
B/P - Systolic 104
B/P - Diastolic 72
BP-Sitting 109/70 mmH
BP: 101/72
Systolic Blood Pressure 100 mmHg
Diastolic Blood Pressure 68 mmHg";
// 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/