Skip to content

Commit 6df21af

Browse files
committed
Allow special chars "[({})]" around "dot" in e-mails
1 parent a715559 commit 6df21af

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### Changed
1010

11-
- Improve e-mail regex
11+
- Improve regex to detect e-mails
1212

1313
## Version 0.5.1 (2022-11-11)
1414

weechat_script_lint/script.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,17 @@
106106
# note: this is not a valid e-mail regex; it is very permissive to detect
107107
# only scripts that have no e-mail, even in an obfuscated form
108108
EMAIL_REGEX = re.compile(
109-
# valid email with extra chars allowed (like # and * for obfuscation)
110-
r"([*#a-z0-9_.+-]+ ?(@|[\[({ ] *at[\])} ] *) ?[*#a-z0-9-]+(\.| *dot *)[a-z0-9-.]+)|"
109+
# valid email with extra chars allowed (like # and * for obfuscation), eg:
110+
111+
# some.name AT domain.org
112+
# some.name [at] domain [dot] org
113+
r"("
114+
r"[*#a-z0-9_.+-]+ ?" # some.name
115+
r"(@|[\[({ ] *at[\])} ] *) ?" # "@", "[at]", " AT "
116+
r"[*#a-z0-9-]+ ?" # domain
117+
r"(\.|[\[({ ] *dot[\])} ] *) ?" # ".", "[dot]", " DOT "
118+
r"[a-z0-9-.]+)" # org
119+
r"|"
111120
# <some.email>
112121
r"(<[a-z0-9_.+-]+>)",
113122
flags=re.IGNORECASE,

0 commit comments

Comments
 (0)