6 kyu
Validate my Password
3,419 of 3,771Capocaccia
Loading description...
Regular Expressions
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.
Aww no python :(
Lua translation ready for review !
C#:
No random tests
Method name should be
PascalCase
(Please refer to implementation of backward compatibility here )Test code should be removed from preloaded: https://www.codewars.com/kata/reviews/5e935140955e440001e9ea1d/groups/6764af59f0e46282e42c620a
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/195.
Please join the discussion to help us identify duplicate kata and retire them.
translation https://www.codewars.com/kumite/5a0ef9f269759877cc0000d2?sel=5a0ef9f269759877cc0000d2
Why? 'a12' , 'INVALID' (JS)
Not a kata issue, the condition for this test is clearly detailed in the description:
More than 3 characters but less than 20
.Then 'a12' must be "VALID".
No, count again, 'a12' has only 3 characters, not more than 3.
One of the criteria is "More than 3 characters but less than 20". Which means 4 to 19 characters. But in tests we see check "<=20".
You're talking about javascript, right?
Yes.
Pressed TEST - 2 fails, pressed SUMBIT - everything passed
'1Username' => 'INVALID'
Why?
Should the password not start with a number (0-9) Details not clear.
see the issue posted just before your comment
Remove this test from javascript sample tests:
Test.assertEquals( validPass('1Username') , 'INVALID' );
or change the expected result to'VALID'
CHANGED TO 'VALID'~~~~
Regrading C#: please add the static to the starting method snice it's missing and will throw error.
This comment has been hidden.
Yeah I'm wondering this too.
need more than one number. should be more clear in the description.
No, that sample test should be removed. The control function returns
"VALID"
with that input.JavaScript
I was hacking away with some lame regex and fell upon a partial solution that sometimes passes.
Adding this test will prevent similar solutions from passing:
uncertain about other languages
Why would that input value be invalid?
This is related to the
"1Username"
sample test mentioned in the thread just above which was active at the time I was solving the kata: that test reflected an invalid variable in either C# or JS, which led me to think the password conditions would be the same, and that the test I presented would make sense. Now that that test itself has been rendered invalid, I clearly see the difference, thanks.There is no test case in which the non-alphanumeric character is in the beginning or the middle.
This test case does not follow your own requirements (more than 3, less than 20, 1 letter, 1 number, only letters and numbers) Test.assertEquals( validPass('1Username') , 'INVALID' );
So it should be corrected to VALID
Python translation
C++ Translation
Please look at it
C# Translation Please look over it.
'ALR APPROVED SOME TIME AGO'
(why are you shouting...?)
x)
Random tests are full of issues:
"INVALID"
which means they are not randomI second this concern, I was able to create a regex that should've failed for a test containing 4 numeric characters only.
No fixed tests.
One of the criteria is "More than 3 characters but less than 20". Which means 4 to 19 characters.
Quite a few of the solutions use the regex quantifier {3,20} which are inclusive bounds. ie 3 to 20 characters.
So it seems that your tests have not picked that up.
Wrong tests and/or incomplete description;-)! Your own solution contains a check which is not part of your description...
I need to know what problem you are having in order to resolve it.
The problem is line 5 of your code "var letter=". "123abcd" for example returns a number...
Are you talking about the isNaN check? That checks to see if the argument is only a number and does not contain letters.
"123abcd" is valid or not - look at your description... Your code gives "invalid" (because of this line). But it's as valid as "abcd123";-)
Thanks! I am investigating that now. I am not sure why parseInt retunrns an int value when provided '123abc'.
I have made an adjustment and this issue should now be resolved.
This comment has been hidden.
EDIT : It seems OK now.
; ) )
Looks like a duplicate to me, what do you think? https://www.codewars.com/kata/password-validator
Ya id say so. There are lots of these going around with varying conditions. Oh well. Im working on a new one already.
In that case you may want to revert it back to Draft.