// 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)\b\d+\s*(?:lac|crs?|k)\b\.?").unwrap();
let string = "65 lac this is 55 lac. and more price 100 lac. randome text to test price45 crs. and 65 cr and to test its matching rs 3244 k like rs 55k. to its matchibg 65 cr. but not 65 cr als not matching price 123 lac more of it 55 crs.
65 lacthis is 55 lacand more
it should not match this65 lac and this 55 lac and this87lac
it should not match this65 lac and this 55 lacand this87lacdsdsa
should match 76 lac. nd 7 cr. including . It shoudl match 78 lac and 74 crs as well";
// 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/