{ for (n, line) in stdin().lock().lines().enumerate() { let line = line?; let line = line.trim_end(); if line.is_empty() { eprintln!("warning: empty line!"); } println!("{:>6}: {}", n, line.trim_end()) } Ok(()) }
date (?P<m> \d{2} ) # the month / (?P<d> \d{2} ) # the day / (?P<y> \d{4} ) # the year ", ) .unwrap(); } let before = "01/30/2018, 12/12/2019"; let after = RE.replace_all(before, "$y-$m-$d"); assert_eq!(after, "2018-01-30, 2019-12-12");