Skip to content

Commit

Permalink
Allow domain with one digit at the beginning or between two dots
Browse files Browse the repository at this point in the history
This should fix python-validators#95
  • Loading branch information
marmeladema committed Feb 24, 2019
1 parent 359653a commit 2ddf857
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
'underscore_subdomain.example.com',
'something.versicherung',
'11.com',
'somerandomexample.xn--fiqs8s'
'somerandomexample.xn--fiqs8s',
'ktbooks.1.v77.faidns.com',
'us.2.cqcounter.com',
'ms127.0.0.101341.club',
'1.adbrite.com',
])
def test_returns_true_on_valid_domain(value):
assert domain(value)
Expand Down
2 changes: 1 addition & 1 deletion validators/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .utils import validator

pattern = re.compile(
r'^(:?(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|' # domain pt.1
r'^(:?(([a-zA-Z0-9]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|' # domain pt.1
r'([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|' # domain pt.2
r'([a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]))\.)+' # domain pt.3
r'([a-zA-Z]{2,13}|(xn--[a-zA-Z0-9]{2,30}))$' # TLD
Expand Down

0 comments on commit 2ddf857

Please sign in to comment.