5 kyu
Would you believe... Talk like Siegfried
160 of 499dinglemouse
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.
This kata is very nice.
sample tests are annoying
unclear specs
Fixed that point
Great kata ^^
you, really gotta update the python test framework
Duplicate issue below
Any Pythony person want to fix this for me? I don't speak Python.
Do I really need to track the week number? Or am I just not seeing the purpose of it?
I'm using Js, and the parameter does not seem to have valuable data... (could just use regex in order)
Kata says
If you try to do differently you might come to grief.
e.g. These are not the same.
oou
->ou
(week 3 rule for doubles) ->u
(week 5 rule for ou)oou
->ou
(week 5 rule for ou)Yeah, I understand that.
But I dont understand why should I need to use the number. I can just use regex in the correct order (the one specified by the kata)
Because you need to know to when stop processing after applying the right number of rules.
If you apply every rule all the time then you will not get the expected result. e.g. See the sample tests. Expectations differ for different weeks.
Your Katas are always enjoyable! :)
Please use new python test framework.
Done.
Fun kata! Would have been harder to fudge, certainly for me, if the "sm -> schm" rule (a rule to increase the length of the string rather than shorten it) didn't just occur in a single sentence case. It would have forced me to find a better method to pass the tests. Although I'll improve my method anyway for personal development. :)
Nice kata but is argument week supposed to always be 1? I had to implement counter to keep track of weeks which was causing me trouble with random tests.
Which language?
Javascript
Argument week is not passed in properly, always got '1' while expecting 2,3,4,5.
Fun kata, made me learn how to use references to capture groups to only replace desired parts of matches. A really nice alternative to using lookarounds.
Nice kata as usual.:)
Shorter sample tests would be useful, which are visually easy to compare, e.g.:
"Certain circles care much"
-->"Sertain sirkles kare much
etc.Also, some evil edge cases could be added; I'm thinking about randomly cased words like
"tHinG"
-->"zinK"
Thanks, got some knowledge about regexs
C# Translation added.Please review and approve~
Zunks :-)
Zunks for zis!
It's a pity zer are only a kupl of desent reg exp katas zer. Zis one is boz funy und useful. Zunks :)
thx :)
Seriously fun to do, thanks for the imaginative kata!
Zunks!
why I get this error everyytime I make the attemt: Test Results: Sample tests "This is KAOS!! We don't play with Code-Wars here!! So there will be trouble for you this time Mr Maxwell Smart! We have reseived all the photographik evidense we need so choose karefully what you say next! I hope you will ko-operate with KAOS and do exaktly what we want Mr Smart otherwise I won't be happy with you! In fakt, if you misbehave that would make me very unhappy indeed... And you sertainly would not want to make me unnesesarily kross would you Mr Maxwell Smart?" should equal "This is KAOS!! We don't play with Kode-Wars here!! So there will be trouble for you this time Mr Maxwell Smart! We have reseived all the photographik evidense we need so choose karefully what you say next! I hope you will ko-operate with KAOS and do exaktly what we want Mr Smart otherwise I won't be happy with you! In fakt, if you misbehave that would make me very unhappy indeed... And you sertainly would not want to make me unnesesarily kross would you Mr Maxwell Smart?"
Because your solution is incorrect according to the requirements.
Carefully compare with the should equal string above.
For example, your string says
Code-Wars
where it should sayKode-Wars
... there are other differences too.okay thanks I have found my problem.
Vel, vel, vel..... I struggle with and pretty nearloathe regex but that was fantastic. One of the best concieved katas I've done yet.
Thank you, for the several hours of head-banging-against-wall hell I've just been through - awesome!!
Zunks for yu kind koment mister henry rr. I am glad yu enjoyed my Kata. I hop yur head is felink beter nov zat yu hav stoped bungink it!
Python translation!
(first time I encounter a kata easier in Java than in python! ;o ... That is... with my approach, of course.)
Approved. Thanks.
\o/ SO COOL! A new DM kata!! :)
But now it's too late for me. 'will take a look at it tomorrow. ;)
Cheers
Not new. Old. Just finally got around to translating it to Java for you...
;D
@smile67
Zunks for aprovink schmile67!Shouldn't
ing
be replaced only on the ends of words?"Inglourious"
(Well, OK. "Ingenious")
OK. Done.
\b
is a zero-length match in regexes, so the$1
in the replacement in the reference solution is superfluous. It doesn't hurt though. (If you take out the$1
, you might as well take out the brackets in the regex.)Ah. Thanks for advice. Clearly I am no regex guru.
I think
expected
is expectink one lesse
than it should. That word isn't long enough to drop the trailinke
.It happens rarely, but it seems sometimes (not always)
be
is wrongly beink shortened tob
.Edit:
So it doesn't only happen on
be
, also on (probably)We
.Yep! Got same kind of error too. ; ) )
Drat! I knew this one would cause me some trouble. Am un-publishing it until I can figure out what went wrong...
Sorry.
:-(
You're doing too much work on the trailing
e
s.Keep it simple. :]
I hop ze trailink
e
bug is fixed now...Loks lik it, yes. Yu shuld realy tuch up ze rst of vek 3 viz \1 zugh. :]
Good work!
OK. Done. Thanks for the tip.