Programming Perl includes:
#!/usr/bin/perl
$vowels='aeiouy';
$cons='bcdfghjklmnpqrstvwxzy';
%map={C=>$cons, V=>$vowels;
for $class=($vowels, $cons) {
for (split //, $class) {
map{$_}.=$class;
}
}
for $char (split //, shift) {
$pat.="[$map{$char}]";
}
$re=qr/^${pat}$/i;
print "REGEX is $re\n";
@ARGV='/usr/dict/words'
if -t && !@ARGV;
while (<>) {
print if /$re/;
}
Which takes a word, and builds a template from it with the same pattern of vowels and consonants. Although the original is commented. Extending this to handle digits should be easy. The cunning part will be collapsing the multiple character classes down, and using a multiple instead.
This is, of course, left as an exercise for the reader ;-)
--
Tommy
Too stupid to live.
Too stubborn to die.