in reply to regexp puzzle
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.)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"}
|
|---|