in reply to Re: how to count the number of repeats in a string (really!) [regexp solution]
in thread how to count the number of repeats in a string (really!)

You made the same mistake I did. It fails to find two 'aba' in 'ababa'.

Replies are listed 'Best First'.
Re^3: how to count the number of repeats in a string (really!) [regexp solution]
by lodin (Hermit) on Nov 16, 2007 at 22:23 UTC

    Mistake and mistake. That's not how I interpreted the question. The problem statement is a bit vague on this. For practical purposes I don't think 'aaa' should report 2 x 'aa' as well.

    If this is the task however, it's better to just exhaustively match everything of a minimum length. The problem as I (and you?) interpreted it is actually more interesting, I think.

    lodin