in reply to searching characters
my $regex = join "[^$_]*", ($_) x $limit; [download]
That way the regex won't backtrack.