// 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).*SFR$").unwrap();
let string = "1468 SFR-PHOTO_000-€
CAP- 1235 SFR1-
C-Z01434-SFR- PHOTO 000-
C-Z01468-SFR
SN- 1468 --SFR•+-CE•-•Request-for-approval
PAC-X0123 SFR-
B-00123•- Invoice for ABC
C-925303-SFR-
C-L25254-SFR
C-LP1122 SFR-
A-123456 SFR
A-789654 SFR
A-Q12345-SFR
DDD-BN4455_SFR
WWW 78955_SFR
V 963852-SFR";
// 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/