in reply to Puzzle Regex: Letter Frequency Arithmetic Sequence
Just a tiny little cheat :)
#!/usr/bin/perl # http://perlmonks.org/?node_id=1201500 use strict; use warnings; $| = 1; my $file = '/usr/share/dict/words'; open my $fh, '<', $file or die "$! opening $file"; while(<$fh>) { chomp; /[^a-z]/ and next; "$_\n$_" =~ /^ (?= .* (.) .* \n (?: (?:(?!\1).)* \1 ){1} (?:(?!\1).) +* $ ) (?= .* (.) .* \n (?: (?:(?!\2).)* \2 ){2} (?:(?!\2).) +* $ ) (?= .{3,3} \n | .* (.) .* \n (?: (?:(?!\3).)* \3 ){3} (?:(?!\3).) +* $ ) (?= .{3,6} \n | .* (.) .* \n (?: (?:(?!\4).)* \4 ){4} (?:(?!\4).) +* $ ) (?= .{3,10} \n | .* (.) .* \n (?: (?:(?!\5).)* \5 ){5} (?:(?!\5).) +* $ ) (?= .{3,15} \n | .* (.) .* \n (?: (?:(?!\6).)* \6 ){6} (?:(?!\6).) +* $ ) (?= .{3,21} \n | .* (.) .* \n (?: (?:(?!\7).)* \7 ){7} (?:(?!\7).) +* $ ) (?= .{3,28} \n | .* (.) .* \n (?: (?:(?!\8).)* \8 ){8} (?:(?!\8).) +* $ ) (?= .{3,35} \n ) /x and print "$_ "; } print "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Puzzle Regex: Letter Frequency Arithmetic Sequence
by LanX (Saint) on Oct 20, 2017 at 15:30 UTC | |
by tybalt89 (Monsignor) on Oct 20, 2017 at 15:54 UTC | |
by LanX (Saint) on Oct 20, 2017 at 16:10 UTC |