]> git.proxmox.com Git - pve-common.git/commitdiff
JSONSchema: refactor tag regex
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 21 Jun 2022 09:19:49 +0000 (11:19 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 20 Sep 2022 11:19:02 +0000 (13:19 +0200)
we'll use that elsewhere too

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/JSONSchema.pm

index ab718f3570e047dd73686e6b83d695db462d05c5..54c149dc7a7f326acc36763ca17a75390ed7cf70 100644 (file)
@@ -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;