http://qs321.pair.com?node_id=1201606


in reply to Re: Puzzle Regex: Letter Frequency Arithmetic Sequence
in thread Puzzle Regex: Letter Frequency Arithmetic Sequence

...sum the count of matches...

There's always the brute force method of generating every possible regex, assuming arithmetic sequence starting at 1. For a max frequency of 6, this covers 21 letter words. It makes me wonder what the breaking point is of my machine.

Note that in (3), only lengths that are triangular will do.

I'll have to find some time to chase this -- perhaps tomorrow.

-QM
--
Quantum Mechanics: The dreams stuff is made of

  • Comment on Re^2: Puzzle Regex: Letter Frequency Arithmetic Sequence

Replies are listed 'Best First'.
Re^3: Puzzle Regex: Letter Frequency Arithmetic Sequence
by LanX (Saint) on Oct 18, 2017 at 17:33 UTC
    I just remembered that Perl supports recursive regexes and relative back-references, so you might not be limited to a hard limit.

    Unfortunately I don't have the time to play with it.

    FWIW if using s///g was allowed you just needed a pattern which repeatedly deleted one character of each group, iff exactly one of them is unique.

    Your criterion was met, if the string is empty afterwards.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!