Hi Bakul,
You can write a program to generate all permutations
and use that as
your regexp. For example abc maps to abc|acb|bac|bca|cab|cba.
Being lazy, I tend to use a shell's brace expansion and then whittle it
down to generate permutations. I keep thinking it's surprising there's
no Bell Labs program to produce them given there's things like
factor(1).
The brace expansion is wasteful as it's going from n**l down to n! and
it can result in the old bash here not responding to SIGINT for a while
if it's producing gazillions.
$ printf '%s\n' {b,a,d,u,g,l,y}{b,a,d,u,g,l,y}{b,a,d,u,g,l,y}\
{b,a,d,u,g,l,y}{b,a,d,u,g,l,y}{b,a,d,u,g,l,y}{b,a,d,u,g,l,y} |
egrep -v '(.).*\1' |
fgrep -x -f - /usr/share/dict/words
ladybug
$
--
Cheers, Ralph.