5 kyu
Domain name validator
335 of 574Disassembler0
Loading description...
Regular Expressions
Strings
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Fancy kata on pattern matching, I really like it.
The rules are somewhat vague, but I really enjoyed creating efficient regex for this kata.
In the test category "LengthTests" I think instead of "some-horribly-long-domain-name-this-time-longer-than-63-charaters.zzz" the given text should be "some-horribly-long-LEVEL-name-this-time-longer-than-63-charaters.zzz".
As the level name is longer than 63 characters I think the result for this test should be false not true. BUT I am not quite sure because it is not clear from the output which test of the test category it refers to.
Python fork with random tests and standard failure messages: https://www.codewars.com/kumite/64b321a2206744001d337b9e?sel=64b321a2206744001d337b9e
Submitted a Javascript translation for this kata.
My solution [python] is passing all of the tests except one and i have no idea what is wrong because all it says is "value is not what was expected". But what was expected? I only know it's something about length, but i already tried every "missed by one" possible errors and no luck.
What does the 7th test in the length group test for?
Not sure what you're asking, do you mean which rule are you getting wrong? Which test is the seventh test? Easier for people to answer you if you show the output and argue for why it should be your answer instead of the one the test wants. Or if you're wondering what the input was, then I mean ask what the input was, but, you can print that. All around I'm really confused.
Oh right, i can print that, i forgor 💀.
My regex is wrong, i know it, i just couldn't figure out why it was failing one of the tests. Now that i printed it, i see that it was the test for 253 total characters limit (and that it's not 7th, it's #8 out of 10 length tests...).
Thanks for the assist.
Python: tests use
test.expect
, what makes failed tests emit poor failure messages.Python (at least): no random tests
The same for PHP
Fix:
https://www.codewars.com/kumite/64b45a832067442d2333832f
Python update to decorator syntax.
.
This comment has been hidden.
Great Kata!!!
PowerShell translation Kumited! :)
Broken, on attempt the following error occurs (unrelated to solution code): File "main.py", line 42 SyntaxError: Non-ASCII character '\xc5' in file main.py on line 42, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Seems to work fine now.
Hi,
I encounter some weird things, in the python version. Meanning: things that seem incoherent with the description (but maybe I did not understand what was said...) :
''
as TLD is valid, but see example tests :not validate('.codewars.com')
=> !???validate('1234.com'))
is excpected to beTrue
=> !??!!??validate('127.0.0.1'))
which is expected to be invalid...Seems to me that is inconsistent... Or what did I miss ? (I'm a bit lost, here...)
OK, it seems like the description should rather be :
There is still the trouble about
validate('.codewars.com')
to adress...EDIT: Except that... This is not consistent with one of the first tests, using "(...).more.than.253.(...)" or even this one : "1.1.168.192.in-addr.arpa" (both are excpecting
True
)...I'm definitely lost, here...
OK, I got it: "TDP" is actually the LAST part of the domain name, and not the first. You should make that explicit for those who are not familiar with the concept. ;)
@Blind4Basics,
In response to your comment above, I have inserted a link to the Wikipedia page on Top-level domain at the first mention/occurrence of the term "TLD" in the Kata Description; hope this addresses your concern :D
Cheers, donaldsebleung
This comment has been hidden.
[PHP Version] Good code coverage with plenty of fixed assertions and a few edge cases but it would still be good to see random tests implemented sometime to further prevent hardcoded and/or logically flawed solutions from passing. Anyway, consider your Kata approved :D
Great kata, thank you :)