Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.06
Fixed in: (no value)



Subject: Wrong strings() output for long (?) regexpes
The following script generates unexpected results: use Regexp::Genex; print ((Regexp::Genex::strings('1234567890[i]'))[0], "\n"); print ((Regexp::Genex::strings('123456789[i]'))[0], "\n"); 1234567890[i] 123456789i It seems that it works OK if there are less than of ten characters before the [...] group. If there are ten characters or more than the [...] group is returned unprocessed. Regards, Slaven
Subject: Re: [rt.cpan.org #23762] Wrong strings() output for long (?) regexpes
Date: Tue, 05 Dec 2006 09:25:31 +1100
To: bug-Regexp-Genex [...] rt.cpan.org
From: bugs [...] bereft.net
Thanks Slaven, Show quoted text
> use Regexp::Genex; > print ((Regexp::Genex::strings('1234567890[i]'))[0], "\n"); > > 1234567890[i]
I'll look into it soon, Brad -- A straw hat or helmet should be worn tilted toward the front. -- Hagakure http://bereft.net/hagakure/
Subject: Re: [rt.cpan.org #23762] Wrong strings() output for long (?) regexpes
Date: Mon, 11 Dec 2006 18:03:44 +1100
To: bug-Regexp-Genex [...] rt.cpan.org
From: bugs [...] bereft.net
Show quoted text
> It seems that it works OK if there are less than of ten characters > before the [...] group. If there are ten characters or more than the > [...] group is returned unprocessed.
There's a bit of bogosity around the strings implementation, there are two work-arounds though. Firstly, you can use the second argument to strings: perl -Ilib -MRegexp::Genex -le 'print +(Regexp::Genex::strings("1234567890[i]",20))[0]' Or you can globally set $Regexp::Genex::DEFAULT_LEN=20: perl -Ilib -MRegexp::Genex -le '$Regexp::Genex::DEFAULT_LEN=20;print +(Regexp::Genex::strings("1234567890[i]"))[0]' This is the implementation leaking through, "strings" matches a generated pattern against a string of "a" x ($_[1] || $DEFAULT_LEN). It may be possible to make the selection of the number of "a"s smarter somehow, as it could be in this case. I'll consider it... would it be useful to you, or are the above work-arounds sufficient? Brad -- ... you should practice diligently with the bamboo sword every day. Superiority is not just a matter of secret techniques ... All professions should be done with concentration. -- Hagakure http://bereft.net/hagakure/
On Mon Dec 11 02:04:12 2006, bugs@bereft.net wrote: Show quoted text
>
> > It seems that it works OK if there are less than of ten characters > > before the [...] group. If there are ten characters or more than the > > [...] group is returned unprocessed.
> > There's a bit of bogosity around the strings implementation, there are > two work-arounds though. Firstly, you can use the second argument to > strings: > > perl -Ilib -MRegexp::Genex -le 'print > +(Regexp::Genex::strings("1234567890[i]",20))[0]' > > Or you can globally set $Regexp::Genex::DEFAULT_LEN=20: > > perl -Ilib -MRegexp::Genex -le '$Regexp::Genex::DEFAULT_LEN=20;print > +(Regexp::Genex::strings("1234567890[i]"))[0]' > > > This is the implementation leaking through, "strings" matches a generated > pattern against a string of "a" x ($_[1] || $DEFAULT_LEN). It may be > possible to make the selection of the number of "a"s smarter somehow, as > it could be in this case. I'll consider it... would it be useful to
you, or Show quoted text
> are the above work-arounds sufficient? >
For now, I can live with the workaround. As an approximation, maybe the default length should just be set to max($DEFAULT_LEN,length($rx)) ? Regards, Slaven