[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Re: all subsets



In article <Pine.GSO.4.21.0105142357200.357-100000@crusoe.crusoe.net>,
	Jeff Pinyan <jeffp@crusoe.net> writes:
> On May 15, Ton Hospel said:
> 
>>We also played with that idea that day. For "real" substrings I came up with:
>>
>>perl -wle 'sub p{pop=~/.+?(??{print$&})/};p("abc")'
> 
> Which breaks on strings with 1 in them.

Sure, this was for a different problem ("real" substrings), and the
assumption was that real words don't contain 1. Otherwise use
(?{}}) and (?!) to enforce a negative cut.

More interesting is how sensitive this kind of program is to details of
the regex optimizer. e.g. it doesn't work if you use .* instead of .+ .
I'm tempted to call many of the behaviours you see when playing with
this stuff a bug. It makes more assumptions than are valid seeing how
unpredictable what (??{}) returns is.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe