Skip to content

Commit 4af0abc

Browse files
committed
Extract duplicated regex
This makes that we only have to verify mistakes once and not get small typos.
1 parent 4a53524 commit 4af0abc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

webapp/src/Validator/Constraints/TimeStringValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function validate(mixed $value, Constraint $constraint): void
3232
"/^(" . $absoluteRegex . "|-" . $relativeRegex . ")$/";
3333
$message = $constraint->absoluteRelativeMessage;
3434
} else {
35-
$regex = "/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d(\.\d{1,6})? [A-Za-z][A-Za-z0-9_\/+-]{1,35}$/";
35+
$regex = "/^" . $absoluteRegex . "$/";
3636
$message = $constraint->absoluteMessage;
3737
}
3838
if (preg_match($regex, $value) !== 1) {

0 commit comments

Comments
 (0)