in reply to regexp puzzle

Here's a demo script for the case n = 26:
use warnings; use strict; my $x = 'a' x 26; if($x =~ /a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaa +aaaaaaaaaaaaaaaaaa/) {print "ok\n"} else {print "not ok\n"}
That takes a few seconds to run on my box. As you increase the value of n, the time taken increases markedly. (Each time you increment n, you also have to prepend an 'a?' to the beginning of the regex, and append an 'a' to the end.)

Cheers,
Rob