Ad
  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Yes, you're absolutely right! My code is wrong.
    I remember being a bit annoyed by the opinionated tests, so I might have taken a shortcut there.
    That's a sin of course, sorry for that ;-)

    At a glance, the two things that might be the issue here are:

    • Not clamping my regular expression with ^......$, making my regular expression a check to see if an IP-adres is somewhere within the provided string, instead of checking that the full string is following the IP-address format. That is what makes 07.1.1.1 valid, since the 0 is ignored by the regex.
    • making the number format [1-9]\d{0,2}, which says that the first number in an octet should always be 1 - 9. That is what breaks 127.0.0.1 here, since that one shows that a 0 is a perfectly fine number as well.
    • I can't really explain 08.1.1.1 right now, but I'll create a new iteration in a minute, in which I test that case as well.

    Thanks for your comment, much appreciated!