use regex::Regex; fn main() { let re = Regex::new(r"^\w{5}$").unwrap(); let text = "hello"; if re.is_match(text) { println!("Match found!"); } else { println!("No match."); } }