fix: luogu problem id validator
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-03 15:04:34 +08:00
parent 94f31d0620
commit 1c0003a7e0
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -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);
}