// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)(?:\d([\-\. ])?){7,15}").unwrap();
let string = "888-426-6840 215-861-6239
SPAIN Toll-Free: 900-8-01334
Caller Paid: 9-1-7878580
ITN Number: (*8) 2650 6840
Sandy Phillips 845-433-6476
USA Toll-Free: 888-426-6840
USA Caller Paid: 215-861-6239
Blackberry One Click +1-888-426-6840x6014774#
Call-In#: 888-426-6840 or 215-861-6239
USA/Mexico Toll-Free: 888-426-6840
Hungary Toll-Free: 06-800-19-306
Canada Toll-Free: 888-426-6840
UK Toll-Free: 0800-368-0638/02030596451
USA Toll-Free: 888-426-6840
USA Caller Paid: 215-861-6239
United Kingdom Caller Paid 0-20-30596451
United Kingdom Toll-Free 0800-368-0638";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/