Re: Enumerating Regular Expressions

2006-05-09 Thread Karthik Gurusamy
[EMAIL PROTECTED] wrote: > James Stroud wrote: > > 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? > > Well sure it might be a little difficult to figure _that_ out, although > probably not all that hard if yo

Re: Enumerating Regular Expressions

2006-05-09 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi all, > > Does anybody know of a module that allows you to enumerate all the > strings a particular regular expression describes? Make a generator that yields *all* strings in your chosen alphabet (see the monthly threads about permutations and combinations for hints

Re: Enumerating Regular Expressions

2006-05-09 Thread Mirco Wahab
Hi blair.bethwaite > I want a tool that can enumerate a regex, > with support for generating each string > described by the regex in some predefined order. If you run the regex against some target string, this is gonna be easy (but maybe not what you want). If you have the string 'Python' and

Re: Enumerating Regular Expressions

2006-05-09 Thread Boris Borcic
[EMAIL PROTECTED] wrote: > Hi all, > > Does anybody know of a module that allows you to enumerate all the > strings a particular regular expression describes? > > Cheers, > -Blair > By hand write down a generator that will solve the simplest case of '.*' as a regexp, and filter the output of th

Re: Enumerating Regular Expressions

2006-05-09 Thread Tim Chase
> Why are people getting stuck on infinite regular > languages? I've made it quite clear that I'm only really > interested in doing this for finite languages, but that > shouldn't matter anyway. The power of regular expressions is that they define a consice means to encapsulate an infinite numb

Re: Enumerating Regular Expressions

2006-05-09 Thread Diez B. Roggisch
> I thought that was the case, I've found a paper on the topic at least. > Maybe once I've finished some other work I'll give it a shot. It seems > like a fairly useful thing to be able to do with a regular expression > so I just guessed that somebody must have done it already. Just wandering: w

Re: Enumerating Regular Expressions

2006-05-09 Thread blair . bethwaite
Dale Strickland-Clark wrote: > Any regular expression that has an asterisk in it has an infinite number of > possible matches. > > If it has two asterisks, that's an infinite number squared and that's a > really big number. > > You wouldn't want to print them out. We've been over this already. Wh

Re: Enumerating Regular Expressions

2006-05-09 Thread Dale Strickland-Clark
Any regular expression that has an asterisk in it has an infinite number of possible matches. If it has two asterisks, that's an infinite number squared and that's a really big number. You wouldn't want to print them out. [EMAIL PROTECTED] wrote: > Hi all, > > Does anybody know of a module th

Re: Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
Michael J. Fromberger wrote: > > 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. Preferab

Re: Enumerating Regular Expressions

2006-05-08 Thread Michael J. Fromberger
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 dif

Re: Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
James Stroud wrote: > 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? Well sure it might be a little difficult to figure _that_ out, although probably not all that hard if you converted to an FSA or something.

Re: Enumerating Regular Expressions

2006-05-08 Thread James Stroud
[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

Re: Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
James Stroud wrote: > You mean like re.compile(r'.*') ? No. I mean like: >>> regex = re.compile(r'a|b') >>> regex.enumerate() a b >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: Enumerating Regular Expressions

2006-05-08 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hi all, > > Does anybody know of a module that allows you to enumerate all the > strings a particular regular expression describes? > > Cheers, > -Blair > You mean like re.compile(r'.*') ? -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 L

Enumerating Regular Expressions

2006-05-08 Thread blair . bethwaite
Hi all, Does anybody know of a module that allows you to enumerate all the strings a particular regular expression describes? Cheers, -Blair -- http://mail.python.org/mailman/listinfo/python-list