From: Dominik Csapak Date: Tue, 21 Jun 2022 09:19:49 +0000 (+0200) Subject: JSONSchema: refactor tag regex X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=056bbe2da4c14ad01e38aee3e49be4fd92377b27 JSONSchema: refactor tag regex we'll use that elsewhere too Signed-off-by: Dominik Csapak --- diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index ab718f3..54c149d 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -696,12 +696,14 @@ register_standard_option('proxmox-remote', { type => 'string', format => 'proxmox-remote', }); +our $PVE_TAG_RE = qr/[a-z0-9_][a-z0-9_\-\+\.]*/i; + # used for pve-tag-list in e.g., guest configs register_format('pve-tag', \&pve_verify_tag); sub pve_verify_tag { my ($value, $noerr) = @_; - return $value if $value =~ m/^[a-z0-9_][a-z0-9_\-\+\.]*$/i; + return $value if $value =~ m/^${PVE_TAG_RE}$/i; return undef if $noerr;