From 9449f1dad370188cff34f35d33d9eac63f2ccd9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Melan=C3=A7on?= Date: Fri, 4 Mar 2022 18:33:43 -0500 Subject: [PATCH] Make matching for time shifts (in paranthesis) non-greedy, stopping at first closing paren --- pomodoro_to_harvest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index e230f27..fd1f9c5 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -90,7 +90,7 @@ timelog['description'] = (np.where(timelog['description'].str.contains(': '), ti timelog['description'] = timelog['description'].str.strip() timelog['project'] = timelog['project'].str.strip() -timelog['tmp_timeshift'] = timelog['description'].str.extract(r'^(\(.+)\)', expand=False) +timelog['tmp_timeshift'] = timelog['description'].str.extract(r'^(\(.+?)\)', expand=False) timelog['tmp_timeshift'] = timelog['tmp_timeshift'].str.strip().str.replace("(","", regex=False) # In an ideal world we would use https://github.com/bear/parsedatetime or similar and # even better figure out the right date for strings like "Monday" but eh this'll do.