BJörn Lindqvist wrote: > With regexps you can search for strings matching it. For example, > given the regexp: "foobar\d\d\d". "foobar123" would match. I want to > do the reverse, from a regexp generate all strings that could match > it. > > The regexp: "[A-Z]{3}\d{3}" should generate the strings "AAA000", > "AAA001", "AAA002" ... "AAB000", "AAB001" ... "ZZZ999". > > Is this possible to do? Obviously, for some regexps the set of matches > is unbounded (a list of everything that matches "*" would be very > unpractical), but how would you do it for simple regexps like the one > above?
here's a start: http://mail.python.org/pipermail/python-list/2001-August/102739.html (the above generates *some* strings, not all, but the approach it uses can be generalized). </F> -- http://mail.python.org/mailman/listinfo/python-list