The String::Random distribution on CPAN - a Perl module for generating random strings based on a regular expression.