Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • 8991326?s=100

    Basically, instead of passing the list as a single argument, it passes the content of the list each as their own argument.

  • Profile pic

    Great!
    c in it different c in str.lower()

  • Profile pic

    I would also like to know this.

  • 16134967?s=100

    Interesting solution!

  • 13503267?s=100

    I think it's good now. Thanks everyone for the needed critique. Please let me know if it can be improved further.

    Changes: '*' is now '+', as suggested. As such, upon failure it requires a return of NULL, not an empty string, since it is not matching anything (as opposed to matching "zero" of something).

  • 14909989?s=100

    It doesn't make sense to have 'zebra'.match(/[^z]*/) return ebra because regex by the original definition always starts matching from the beginning of a string. Searching with a regex is simply implemented as "try to match this regex on every position starting from the left until a match is found", so the first match at (0, 0) aka '' is returned. It's also why a global regex matching will never return overlapping strings: when a match is found you continue from the end of the last matched position.

    And if you try to claim that for some definition of regex 'zebra'.match(/[^z]*/) should return ebra, you end up with a pile of problems: why should it match ebra and not , bra or ebr? What is the criteria and tiebreaking of choosing the result?

    Also, empty string and null are different results of a regex match: the former means a match that starts and ends at the exact same location, while the latter means there are no matches. They're completely different.

  • 7867810?s=100

    which makes use of regex

    When you try to make use of regex, you should use it correctly.
    Though it is implemented differently across domains, they all agree on what should /[^z]*/ match on zebra

    Kotlin

    Regex("[^z]*").find("zebra")?.value
    

    JS

    'zebra'.match(/[^z]*/)
    

    Python

    import re;re.match('[^z]*','zebra')
    

    i.e. An EMPTY string

    So, you should either

    • Change the expected result from 'ebra' to ''
    • Change all the * marks to +
    • Clearify that the patterns here is similar to Regex but they are totally different
  • 13503267?s=100

    Fixed!

    spaces: but each space is one whole byte on my hard drive, and I only have a few.. eh, GB's left, so.. yeah. :)

  • 13503267?s=100

    I have updated the kata description to reflect that this find function does two things: 1) uses regular expressions to locate substrings, and 2) copies said substring to return. It may be better to present the kata not as primarily a regular expression demonstration, but a tokenizer function which makes use of regex. Does that seem fair?

  • 1228739?s=100

    There's a bug in the test code:

    char*r=calloc(strlen(string),1);
    

    should be

    char*r=calloc(strlen(string)+1,1);
    

    to be able to hold the terminating '\0'.
    Similar in the "Initial Solution".

    Also: Spaces, dude, spaces! ;-)

  • 15977605?s=100

    Awesome job, approved!

  • 40404519?s=100
  • 40404519?s=100

    I find the <<<yours mine>>> thing in the forked description very difficult to work with.

    Same thing for me. Sometimes I copy & paste the description into VSCode, set the language to markdown, it makes merge conflicts easy. Above every conflict it has 4 buttons for whatever you want to do with the changes.

  • 18171520?s=100

    Can only be done by forking the offending translation. You can do that without taking the credit away from the original author of the translation ( but I find the <<<yours mine>>> thing in the forked description very difficult to work with. I prefer to just copy over the current description and start over from there. which is less than ideal ).

  • 15977605?s=100

    Awesome, Approved! Can you let me know how to fix the description merge conflicts so you wouldn't have to update it yourself again?

  • Loading more items...