Ad
  • Custom User Avatar

    To be honest, your solution outsmarted mine. I have to admit that i didn't even think of this solution, and if I had, I would've gone for it definitely. I went for the complex regex right away LOL!

    To my defense, and despite this not being the case, I have to say that the regex solution would be the best practice in a production env for example, where you don't know whether the protocols / domains are likely to change or not. But, of course, the kata didn't specify any of that sooo GGs well played haha.

    Keep it simple!

  • Custom User Avatar

    The purpose of the exercise is whatever you make it to be within the specified constraints. I'd say this is a win. The alternative is a regular expression with complex look-behinds. My own version, which is nearly identical, happens to require the strings appear at the beginning--but even that may be excessively robust.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution