Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

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
}
 
PREVIOUS NEXT
Tagged: #count #matches #regex
ADD COMMENT
Topic
Name
5+6 =