Retired
Make ruby 'match' output similar to js 'match' return (retired)
Loading description...
Regular Expressions
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.
Ruby :
This Kata likely won't get approved unless :
the description is clarified to allow any function to make the desired result happen (in which cases it is ~8 kyu)
if that happens, the kata is likely going to get flagged because then it becomes a very basic grouping Kata
a lot of restrictions are in place to force someone to either just use match or put a lot of work to get around blocks
Nice work on the test suite, aside from that anyway.
This comment has been hidden.
Fun little kata. Might it make sense to disable other things like
eval
,split
, and maybe evenmatch
itself, and add test cases that include other characters? I might definitely have misunderstood your intent.. I was thinking along the lines of a kata that has to do something a little more step-by-step than in one line. If so, ignore me :)Hi @Firefly2002, thank you for your feedback. It's very nice when my work is intresting and dose not waste. This kata is a challange for users of local ruby chat and investigation of Ruby regex. History of creation this kata: I got this js regex
/([?!])\1*/
from solution ofExclamation marks series #18
kata, translating to Ruby found different in behaviour in Ruby/JS regex ( https://goo.gl/4vpKb6 ) . This leads to argue in the local chat, so I created kata to find ways to use Ruby.match work as like JS.match with particular regex.Oh okay :)
So if your intent is to disable the use of
scan
, you need to actually disable it (by un-defining it inpreloaded
.Also you should make sure we're not using other regexes.
Ok. got it. will be wokring with it. Thank you
I thought it possible to solve this problem using
s.match(some_other_regex).some_other_method_may_be
but I do not think in this situation need to prevent other regex.But it's interesting what tis preloaded and how to wield with them. At curren moment I tured off
scan
by rewriting scan method.And also it's intersting how it's possible to prevent othre regex techically. Thank you
Pass in the regex as a parameter?
I'm not sure what is a question? You mean rewrite method and check do regex equal to some othre ethalon?