perl: generating permutations from a regular expression

Posted by wibble on Stack Overflow See other posts from Stack Overflow or by wibble
Published on 2010-04-16T17:22:35Z Indexed on 2010/04/16 17:23 UTC
Read the original article Hit count: 258

Filed under:
|
|

I know you can generate all permutations from a list, using glob or Algorithm::Permute for example - but how do you generate all possible permutations from a regular expression?

i want to do like:

@perms = permute( "/\s[A-Z][0-9][0-9]/" );
sub permute( $regex ) {
    # code - put all permutations of above regex in a list
    return @list;
}

© Stack Overflow or respective owner

Related posts about perl

Related posts about permutations