In article <[EMAIL PROTECTED]>,
 James Stroud <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
> > James Stroud wrote:
> > 
> >>You mean like re.compile(r'.*') ?
> > 
> > 
> > No.  I mean like:
> > 
> >>>>regex = re.compile(r'a|b')
> >>>>regex.enumerate()
> > 
> > a
> > b
> 
> You see the difficulty don't you? How will the computer know in advance 
> that the regex matches only a finite set of possible strings?

You don't.  Hence, you want something that behaves like a generator, and 
will produce the strings one at a time.  Preferably, for the purposes of 
useful computation, in some canonical order.  

I'm sorry to say I don't know of an existing Python module to do this, 
although you could write one for at least the basic regular expression 
operators if you wanted.  The basic problem isn't all that hard to 
solve, though the full generality of the re module's input syntax is far 
more expressive than truly "regular" expressions from language theory.

Cheers,
-M

-- 
Michael J. Fromberger             | Lecturer, Dept. of Computer Science
http://www.dartmouth.edu/~sting/  | Dartmouth College, Hanover, NH, USA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to