even better regex for time parsing

automove
Ondřej Hruška 5 years ago
parent e1eb0c202e
commit ecd1232713
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 2
      src/main.rs

@ -501,7 +501,7 @@ impl TryFrom<&str> for SubDuration {
fn try_from(value: &str) -> Result<Self, Self::Error> {
lazy_static! {
static ref TIME_RE: Regex = Regex::new(r"^(?P<n>-)?(?:(?:(?P<h>\d+):)?(?P<m>\d+):)?(?P<s>\d+(?:[.,]\d+)?)$").unwrap();
static ref TIME_RE: Regex = Regex::new(r"^(?U)(?P<n>-)?(?:(?P<h>\d+):)?(?:(?P<m>\d+):)?(?P<s>\d+(?:[.,]\d+)?)$").unwrap();
}
match TIME_RE.captures(value) {

Loading…
Cancel
Save