in reply to Re: Check a string for consecutive digits
in thread Check a string for consecutive digits

All posts at the time of writing, including the OP, seem to assume that passwords only contain digits; at least, that's all that's being tested.

The code above produces the same output as yours with your test set and suitable modification to the print statement and  $min set to 3.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^3: Check a string for consecutive digits
by kcott (Archbishop) on Nov 26, 2015 at 10:51 UTC

    OK, that's good.

    FWIW, you hadn't posted when I started to write my response but, clearly, you did post before I did.

    "All posts at the time of writing" did not include your post; however, I can see that isn't obvious.

    My apologies for any unintended confusion.

    — Ken

      No problem, nor any need for apology. I just wanted to mention that my approach would also work with the expanded test set. I think it's important to stress your point that any approach to this problem requires a testing framework that can easily exercise all the common, degenerate and corner cases.


      Give a man a fish:  <%-{-{-{-<

        ++ All good and thanks for the thumbs-up on the testing.

        — Ken