// 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"([$£€¥₹])?(\d{1,3}(?:[, ]?\d{1,3})?(?:.\d+)?)(?(1)|(kr\.?|Kč))").unwrap();
let string = "The cost of this car with a 3.5 litre engine, is €2,927.100, or $3 271.32. In Sweden that would be around 27000kr. I would have to work overtime for 215 days to save the money for that, even though my job in the Czech Republic pays 436.5Kč an hour, and I can save 10% percent of that. My buddy in Japan, bought one for ¥357014.83";
// 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/