// 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)(?<=KilometreSI I\\r\\n\*).[0-9\s]+").unwrap();
let string = "El\\r\\n_I ERNST&YOUNC Expense Report\\r\\nI Date Prepared: 01-08-2019 I Managing Country: XE I\\r\\nI Submitted: 01-08-2019 (In Audit) | Business Unit: XE045 I\\r\\n| GPN - Name: XE021000618 — Paul Prashanth | Management Unit: 00801 Sub Management Unit: 0907302 |\\r\\nI Signature: I Approved By: Rank: I\\r\\nI Rank: Administrative Contractor I Approval Signature: I\\r\\nI Expense Details (Attach supporting receipts) I Total Net IC = Chargeable P = Authorized I\\r\\nI Loc I Expense Type I Date I Description I Expense Expense I Type I Engagement I Activity I\\r\\nOTHER International Travel-Non-Billable - Ground 01-08-2019 Need clarification for claiming the taxi expenses P 33800872 0000\\r\\nTransportation - Mass/Public Transportation from same vendor for INR 2400 & No receipts fo\\r\\nTelephone for GBP l (INR 97.89) & Taxi for GB\\r\\n25 (INR 2470.75) Barcode : 2170270878\\r\\nI IIIIII IIIII IIIII IIIII IIIII IIIII IIIII IIIII IIIII IIIII IIII IIII Tom’s I 0.00 I 0.00 I Tom] KilometreSI I\\r\\n* 2 1 7 1 9 5 9 5 2 8 it Report Date Format: dd-mm-yyyy\\r\\nPage 1 of 1 10-06-2020";
// 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/