even better regex for time parsing

This commit is contained in:
2019-06-22 15:40:34 +02:00
parent e1eb0c202e
commit ecd1232713
+1 -1
View File
@@ -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) {