From c58400fa81b74aaaf957786407fc6eeb2a606c92 Mon Sep 17 00:00:00 2001 From: Christian Femers Date: Wed, 31 Mar 2021 19:25:44 +0200 Subject: [PATCH] Use possessive quantifiers for the duration pattern Since this is instructor-defined this should not have been an issue and I cannot see the problem appear with the old regular expression, but it cannot hurt. --- src/main/java/de/tum/in/test/api/internal/TestGuardUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/tum/in/test/api/internal/TestGuardUtils.java b/src/main/java/de/tum/in/test/api/internal/TestGuardUtils.java index 0b9e0943..f1deb8ee 100644 --- a/src/main/java/de/tum/in/test/api/internal/TestGuardUtils.java +++ b/src/main/java/de/tum/in/test/api/internal/TestGuardUtils.java @@ -43,7 +43,7 @@ public final class TestGuardUtils { */ private static final String ZONE_ID_START_PATTERN = "[-+A-Za-z].*"; private static final Pattern DURATION_PATTERN = Pattern - .compile("(?:(?\\d+)d)?\\s*(?:\\b(?\\d+)h)?\\s*(?:\\b(?\\d+)m)?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$ + .compile("(?:(?\\d++)d)?\\s*+(?:\\b(?\\d++)h)?\\s*+(?:\\b(?\\d++)m)?", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$ private TestGuardUtils() { @@ -157,7 +157,7 @@ public static ZonedDateTime parseDeadline(String deadlineString) { /** * Splits the deadline string into the local time part and the time zone part if * present - * + * * @param deadlineString the deadline string of format ISO-LOCAL-DATE(T| * )ISO-LOCAL-TIME( ZONE-ID)? * @return always a string array of length two, the first part is always the