Skip Menu |

This queue is for tickets about the Regexp-Genex CPAN distribution.

Report information
The Basics
Id: 47940
Status: open
Priority: 0/
Queue: Regexp-Genex

People
Owner: perl-cpan [...] bereft.net
Requestors: kwilliams [...] cpan.org
robertik.pl [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.07
Fixed in: (no value)



Subject: Strings contains (){} in regexp are not generated properly
Strings contains (){} in regexp are not generated properly. Few examples: Error with generator: regex string: ((22[0-3]|2[0-1][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}), output string: 220.250 Error with generator: regex string: ((22[0-3]|2[0-1][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}\/(3[012]|[12][0-9]|[1-9])), output string: 220.252/30 Error with generator: regex string: (((22[0-3]|2[0-1][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3})(\ ((22[0-3]|2[0-1][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3})){0,63})?, output string: 221.250 220.253
Thanks for the report. I'll have a look at what's going wrong soon. Here's my simple test cases: [11:24 ~]$ perl -MRegexp::Genex=:all -le 'print for strings(qr/a{1,3}/)' aaa aa a [11:24 ~]$ perl -MRegexp::Genex=:all -le 'print for strings(qr/(a){1,3}/)' a [11:24 ~]$ perl -MRegexp::Genex=:all -le 'print for strings_rx(qr/a{1,3}/)' ## Orignal: (?-xism:a\{1,3\}) ^(?> (?{ @_ = (); "" }) ) ## Initialize $^R & @_ (?: ## (?-imsx: (?: .{1} (?{ $^R."a" }) ){1,3} ## a{1,3} ) ## ) (?{ push @_, $^R }) (?!) ## Save & backtrack [11:24 ~]$ perl -MRegexp::Genex=:all -le 'print for strings_rx(qr/(a){1,3}/)' ## Orignal: (?-xism:(a)\{1,3\}) ^(?> (?{ @_ = (); "" }) ) ## Initialize $^R & @_ (?: ## (?-imsx: ( ## ( -> $1 (?: .{1} (?{ $^R."a" }) ) ## a ) ## ) ) ## ) (?{ push @_, $^R }) (?!) ## Save & backtrack
I've run into what might be the same bug: % perl -MRegexp::Genex=:all -e '$g=generator("(one|two)-hundred"); while (1) { print "\r".($i++).":\t".$g->() }' ... shows that only the empty string is emitted by $g->() It's also noteworthy that this regex should only emit 2 strings, but because of this but it emits infinitely many. -Ken
Hello, On Fri Aug 13 12:01:40 2010, KWILLIAMS wrote: Show quoted text
> I've run into what might be the same bug: > > % perl -MRegexp::Genex=:all -e '$g=generator("(one|two)-hundred"); > while (1) { print > "\r".($i++).":\t".$g->() }' > > ... shows that only the empty string is emitted by $g->() > > > It's also noteworthy that this regex should only emit 2 strings, but > because of this but it emits > infinitely many.
Part of this issue would be due to the $max_length parameter defaulting to 10. So changing it to 20 would allow the one-hundred result to match/appear: $ perl -MRegexp::Genex=:all -e '$g=generator("(one|two)-hundred", 20); while (1) { print "\r".($i++).":\t".$g->() }' 1698^C: two-hundred # The loop keeps going though... $ perl -MRegexp::Genex=:all -e '$g=generator("(one|two)-hundred", 20); while (1) { print +($i++).":\t".$g->(),"\n" }' | head 0: one-hundred 1: two-hundred 2: 3: 4: 5: 6: 7: 8: 9: That snippet may be better written as: $ perl -MRegexp::Genex=:all -e '$g=generator("(one|two)-hundred", 20); while ($_ = $g->()) { print +($i++).":\t".$_,"\n" }' 0: one-hundred 1: two-hundred The original issue still is an issue though. I'm likely to be very slow debugging/fixing it in my current state, however. Thanks for the report and sorry for being so crappy, Brad PS. The repo is now on github http://github.com/bowman/Regexp-Genex