fix: [internal] Simplify regexp

pull/8613/head
Jakub Onderka 2022-10-04 11:03:00 +02:00
parent b7207fb584
commit afa00c8bca
1 changed files with 2 additions and 2 deletions

View File

@ -412,12 +412,12 @@ class AttributeValidationTool
}
return __('Email address has an invalid format. Please double check the value or select type "other".');
case 'vulnerability':
if (preg_match("#^(CVE-)[0-9]{4}(-)[0-9]{4,}$#", $value)) {
if (preg_match("#^CVE-[0-9]{4}-[0-9]{4,}$#", $value)) {
return true;
}
return __('Invalid format. Expected: CVE-xxxx-xxxx...');
case 'weakness':
if (preg_match("#^(CWE-)[0-9]{1,}$#", $value)) {
if (preg_match("#^CWE-[0-9]+$#", $value)) {
return true;
}
return __('Invalid format. Expected: CWE-x...');