On 12/22/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > 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
Thankyou! Who would have known that there is a sre_parse module... makes things quite a bit easier. -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list