[pmg-devel] [PATCH pmg-gui v2] utils: anchor regex expression

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Feb 26 16:32:46 CET 2024


Without anchoring this would match for example `a at b/c`.

Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
---
 js/Utils.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/js/Utils.js b/js/Utils.js
index 9009e9e..149abd6 100644
--- a/js/Utils.js
+++ b/js/Utils.js
@@ -921,7 +921,7 @@ Ext.define('PMG.Async', {
 Ext.apply(Ext.form.field.VTypes, {
     // matches the pmg-email-address in pmg-api
     PMGMail: function(v) {
-	return (/[^\s\\@]+@[^\s/\\@]+/).test(v);
+	return (/^[^\s\\@]+@[^\s/\\@]+$/).test(v);
     },
     PMGMailText: gettext('Example') + ": user at example.com",
 });
-- 
2.39.2





More information about the pmg-devel mailing list