develooper Front page | perl.golf | Postings from January 2007

Re: simple golf for fun

Thread Previous | Thread Next
From:
Phil Carmody
Date:
January 17, 2007 04:13
Subject:
Re: simple golf for fun
Message ID:
732082.98438.qm@web25412.mail.ukl.yahoo.com
--- Ton Hospel <perl-golf@ton.iguana.be> wrote:
> -p0 s/\G(.*)(.*
> )(?=\1.\2|$)//g
> 
> This should be about as efficient as a simple regex
> approach gets. It's also the shortest yet :-)
> It outputs starting from the first line that can't
> be extended. No output means all lines work.

Excellent! That's more useful output too!
31 chars for the alien!

There seemed to be a bug in previous versions (though to be honest not a
serious one, one that could be considered as inviting a loosening of the
specification) - if you added an extra blank line between two real lines, it
would still pass. Funnily enough, my log file did have such a blank line.
It also crashed on my 2500-line file. Your current one doesn't crash.

Many thanks, all!
Phil

()  ASCII ribbon campaign      ()    Hopeless ribbon campaign
/\    against HTML mail        /\  against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]


 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About