mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -257,7 +257,8 @@ _email_regexp = re.compile(
|
||||
([A-Za-z0-9] # Each part of hostname must start with alphanumeric
|
||||
([A-Za-z0-9-]*[A-Za-z0-9])?\. # May have dashes inside, but end in alphanumeric
|
||||
)+
|
||||
[A-Za-z]{2,6}$ # Restrict top-level domain to length {2,6}. Google seems
|
||||
[A-Za-z]{2,24}$ # Restrict top-level domain to length {2,24} (theoretically,
|
||||
# the max length is 63 bytes as per RFC 1034). Google seems
|
||||
# to use a whitelist for TLDs longer than 2 characters.
|
||||
""", re.UNICODE | re.VERBOSE)
|
||||
|
||||
@@ -289,7 +290,8 @@ def ISEMAIL(value):
|
||||
>>> ISEMAIL("john@aol...com")
|
||||
False
|
||||
|
||||
More tests:
|
||||
More tests: Google Sheets Grist
|
||||
------------- -----
|
||||
>>> ISEMAIL("Abc@example.com") # True, True
|
||||
True
|
||||
>>> ISEMAIL("Abc.123@example.com") # True, True
|
||||
@@ -314,6 +316,10 @@ def ISEMAIL(value):
|
||||
True
|
||||
>>> ISEMAIL("Bob_O'Reilly+tag@example.com") # False, True
|
||||
True
|
||||
>>> ISEMAIL("marie@isola.corsica") # False, True
|
||||
True
|
||||
>>> ISEMAIL("fabio@disapproved.solutions") # False, True
|
||||
True
|
||||
>>> ISEMAIL(u"фыва@mail.ru") # False, True
|
||||
True
|
||||
>>> ISEMAIL("my@baddash.-.com") # True, False
|
||||
@@ -324,8 +330,6 @@ def ISEMAIL(value):
|
||||
False
|
||||
>>> ISEMAIL("john@-.com") # True, False
|
||||
False
|
||||
>>> ISEMAIL("fabio@disapproved.solutions") # False, False
|
||||
False
|
||||
>>> ISEMAIL("!def!xyz%abc@example.com") # False, False
|
||||
False
|
||||
>>> ISEMAIL("!#$%&'*+-/=?^_`.{|}~@example.com") # False, False
|
||||
@@ -391,7 +395,8 @@ _url_regexp = re.compile(
|
||||
([A-Za-z0-9] # Each part of hostname must start with alphanumeric
|
||||
([A-Za-z0-9-]*[A-Za-z0-9])?\. # May have dashes inside, but end in alphanumeric
|
||||
)+
|
||||
[A-Za-z]{2,6} # Restrict top-level domain to length {2,6}. Google seems
|
||||
[A-Za-z]{2,24} # Restrict top-level domain to length {2,24} (theoretically,
|
||||
# the max length is 63 bytes as per RFC 1034). Google seems
|
||||
# to use a whitelist for TLDs longer than 2 characters.
|
||||
([/?][-\w!#$%&'()*+,./:;=?@~]*)?$ # Notably, this excludes <, >, and ".
|
||||
""", re.VERBOSE)
|
||||
@@ -437,6 +442,8 @@ def ISURL(value):
|
||||
True
|
||||
>>> ISURL("http://foo.com/!#$%25&'()*+,-./=?@_~")
|
||||
True
|
||||
>>> ISURL("http://collectivite.isla.corsica")
|
||||
True
|
||||
>>> ISURL("http://../")
|
||||
False
|
||||
>>> ISURL("http://??/")
|
||||
|
||||
Reference in New Issue
Block a user