// 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+), 2020").unwrap();
let string = "(190497, 2020, 'FedEx First Overnight', '2', '2', NULL, 1, 'lb', 'letter', NULL, 55.35, NULL, NULL, NULL, NULL),
(190498, 2020, 'FedEx Priority Overnight', '2', '2', NULL, 1, 'lb', 'letter', NULL, 25.35, NULL, NULL, NULL, NULL),
(190499, 2020, 'FedEx Standard Overnight', '2', '2', NULL, 1, 'lb', 'letter', NULL, 24.85, NULL, NULL, NULL, NULL),
(190500, 2020, 'FedEx 2Day AM', '2', '2', NULL, 1, 'lb', 'letter', NULL, 19.40, NULL, NULL, NULL, NULL),
(190501, 2020, 'FedEx 2Day', '2', '2', NULL, NULL, 'lb', 'letter', NULL, NULL, NULL, NULL, NULL, NULL),";
// 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/