commit b00a804c0abe6768070f4345c91ee8528b97be3a
parent 4125b04962697decc6d87e7bc7a437be5125adc7
Author: gearsix <gearsix@tuta.io>
Date: Sat, 31 Jul 2021 19:54:24 +0100
improved Timestamp regex
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/BUGS.txt b/BUGS.txt
@@ -11,9 +11,10 @@
## List
**2021-07-31** [ ] don't apply file numbering when song names include file number already
+
#regex-improvement
-**2021-06-22** [ ] handle multiple timestamp regex matches
+**2021-06-22** [*] handle multiple timestamp regex matches
When there are multiple matches for the timestamp regex in a line, the last match is used as the timestamp.
Discovered that the following line causes an issue because 2019 is counted as a timestamp
diff --git a/sya.py b/sya.py
@@ -7,7 +7,7 @@ import re
import os
import sys
-Timestamp = re.compile('[\[,\(]?(:?\d{1,2}){3}[\],\)]?')
+Timestamp = re.compile('[\[\(]?((\d+:)+(\d+))[\]\)]?')
class TracklistItem:
def __init__(self, timestamp, title):