even better regex for time parsing
This commit is contained in:
+1
-1
@@ -501,7 +501,7 @@ impl TryFrom<&str> for SubDuration {
|
|||||||
|
|
||||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||||
lazy_static! {
|
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) {
|
match TIME_RE.captures(value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user