extern crate regex;
use regex::Regex;
fn main() {
// Find, extract, replace dates in text
let re = Regex::new(r"(?x)
(?P<yyyy>d{4})-(?P<mm>d{2})-(?P<dd>d{2})").unwrap();
let before = "The dates are 2020-04-13, 2021-07-23 and 2019-05-07";
let after = re.replace_all(before, "$dd/$mm/$yyyy");
println!("Before: {}", before);
println!("After: {}", after);
}