in reply to Regex question once-only use of chars in a charset

I doubt this fits what you have described, but it may be of interest:

#!/usr/local/bin/perl use strict; use warnings; my @words = split /\s+/, <<WORDS; a alien all allows always an and are as best but can certainly command confession context counting dictionary does each even fact find for fo +und from have here hope i if immediate importance intuitively is just letter le +tters like list low make mimic monks my need never obvious occur of one only opti +on pattern per perl physical plainer pure question quite regex regexp search tabl +et that the these thing think this those to tokens up use using which with wor +ds you WORDS my %normLu; push @{$normLu{normWord ($_)}}, $_ for @words; my $match = buildRegex ('adeilln'); my @matches = map {@{$normLu{$_}}} grep {/^$match$/} keys %normLu; print "@matches\n"; sub normWord { return join '', sort split '', $_[0]; } sub buildRegex { my ($word) = @_; my %freq; ++$freq{$_} for split '', $word; return join '', map {"$_\{0,$freq{$_}\}"} sort keys %freq; }

Prints:

alien all and an a i
True laziness is hard work