From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui] utils: escape `/` in regex for emails
Date: Thu, 30 Nov 2023 13:44:16 +0100 [thread overview]
Message-ID: <20231130124416.176516-1-m.sandoval@proxmox.com> (raw)
As it is, it is valid ECMA regex but invalid in many other dialects. We
escape it to make it valid in, say PCRE2.
Note that `/` marks the end of the regex [1], hence
Some@example@oh\no@
is valid according to this regex if we do not escape `/`.
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_escape
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
Fun fact: This was detected by xgettext while doing tests extracting
strings for translations.
js/Utils.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/js/Utils.js b/js/Utils.js
index 7fa154e..8974cb9 100644
--- a/js/Utils.js
+++ b/js/Utils.js
@@ -903,7 +903,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@example.com",
});
--
2.39.2
next reply other threads:[~2023-11-30 12:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 12:44 Maximiliano Sandoval [this message]
2024-02-23 18:11 ` Stoiko Ivanov
2024-02-26 7:07 ` Dominik Csapak
2024-02-26 12:14 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231130124416.176516-1-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.