Answers for "regex count number of match"

0

count matches with regex

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
}
Posted by: Guest on June-29-2021

Code answers related to "regex count number of match"

Browse Popular Code Answers by Language