6 kyu
Regex for a decimal number divisible by 4
384 of 419kolichj
Loading description...
Regular Expressions
Puzzles
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.
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/228.
Please join the discussion to help us identify duplicate kata and retire them.
Very nice kata of the series to learn more about regular expressions.
Potential duplicate of Mod4 Regex
Python, possibly other languages: tests miss sanity checks on values returned by user solution and crash badly when an unexpected value (not a pattern, or not a valid pattern) is returned.
How is it kyu6? I'm unable to get my regex to 50 chars
How is it a proof it is not 6kyu?
I was able to complete a 1ku (and the others as well) for number divisible by n in less time than this. I'm still unable to complete this one and I have no idea what am I missing.
I completed katas in all kyus and I'm still unable to solve some 7/6kyu, but I don't draw any conclusion from that relative to the kata's ranking. You are (or I am) unable to solve it just means you are (or I am) unable to solve it. Maybe you are (I am) just bad in some areas.
The limit of 50 characters is way too restrictive if the purpose is just to prevent hardcoding. Either lower it down or change the description to "to make it more challenging"
Ruby 3.0 should be enabled, read this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
Enabled in this fork
Can u check please the test case for -20, it is divisible by 4 (-5), my regex fails only there, since it's expecting False.
Ruby translation kumited -- please check and approve.
Great! Approved!
Thanks
This comment has been hidden.
Multiline test cases are unnecessary, i think. The point of kata is to find a way to detect divisibility. It's not about fancy format checking...
Then it should be specified that there are no
\n
and no non-ASCII characters or that it's always a number or something like that, otherwise it's not clear what it shouldn't match.Added this line to the description:
I suggest to add a (few) fixed cases where there is a 2-digit number inside which is divisible by 4, but the full number is not. e.g.:
1243 --> False
Oh, and you could fit into 50 chars a regex that doesn't allow leading zeros, too ;-)
Done