April 2026
Intermediate
631 pages
16h 20m
English
In this section, we’ll provide some practice questions to help reinforce your learning. The exercise questions cover almost all the concepts introduced in the chapter. Solutions to each exercise will follow in Section 17.6.
Matching telephone numbers without using \d shorthandWrite a regex to match the two telephone numbers in the provided string but without using the shorthand character class \d. Modify the regex in the following code to match the phone numbers 816030 and 816694.
use regex::Regex;fn main() { let re = Regex::new(/*Your regex here*/r"^\d......").unwrap(); let text = "My phone number is 816030 and the second phone number is 816694"; for cap in re.captures_iter(text) { println!("match: {:?}", &cap
Read now
Unlock full access