use regex::Regex; fn main() { // count matches with regex let re = Regex::new(r"(?i)th").unwrap(); let result = re.find_iter("The three truths.").count(); println!("result = {}", result); // 3 }