From 1c0003a7e0c15e20c39352b9fc8087dee54e51b8 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Fri, 3 Feb 2023 15:04:34 +0800 Subject: [PATCH] fix: luogu problem id validator --- web/app/libs/uoj-validate-lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/libs/uoj-validate-lib.php b/web/app/libs/uoj-validate-lib.php index 82b2d95..44a22c3 100644 --- a/web/app/libs/uoj-validate-lib.php +++ b/web/app/libs/uoj-validate-lib.php @@ -77,9 +77,9 @@ function is_short_string($str) { } function validateCodeforcesProblemId($str) { - return preg_match('/(|GYM)[1-9][0-9]{0,5}[A-Z][1-9]?/', $str) !== true; + return preg_match('/^(|GYM)[1-9][0-9]{0,5}[A-Z][1-9]?$/', $str); } function validateLuoguProblemId($str) { - return preg_match('/P[1-9][0-9]{4,5}/', $str) !== true; + return preg_match('/^P[1-9][0-9]{3,5}$/', $str); }