make email regex slightly more readable
This commit is contained in:
parent
d17d568961
commit
4cf0abb027
1 changed files with 4 additions and 2 deletions
|
@ -136,8 +136,10 @@ module BrowseTagsHelper
|
||||||
# Uses WHATWG implementation of email validation, which follows RFC 1123
|
# Uses WHATWG implementation of email validation, which follows RFC 1123
|
||||||
# but is a willful violation of RFC 5322.
|
# but is a willful violation of RFC 5322.
|
||||||
# (see: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address)
|
# (see: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address)
|
||||||
if value.match?(%r{^\s*[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\s*
|
if value.match?(%r{^\s*[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+
|
||||||
(;\s*[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\s*)*$
|
@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\s*
|
||||||
|
(;\s*[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+
|
||||||
|
@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\s*)*$
|
||||||
}x)
|
}x)
|
||||||
return value.split(";").map do |email|
|
return value.split(";").map do |email|
|
||||||
# remove any leading or trailing whitespace if present
|
# remove any leading or trailing whitespace if present
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue