Front page | perl.golf |
Postings from January 2007
Re: simple golf for fun
Thread Previous
|
Thread Next
From:
perl-golf
Date:
January 17, 2007 05:10
Subject:
Re: simple golf for fun
Message ID:
eol76a$f41$1@post.home.lunix
In article <45AE139E.9000706@gmx.at>,
Daniel Tiefnig <d.t@gmx.at> writes:
> If you're free to output whatever you want on mismatch, you can also
> just omit the "\G".
>
> -p0 s/(.*)(.*
> )(?=\1.\2|$)//g
>
> Will print all lines that preceed invalid changes. (As requested!) One
> can create files that will make some problems, though. If a line does
> not add at least one character, strange things may happen. But I think
> it will always output something.
> And until someone proves the contrary, I consider this being the
> shortest solution so far. :o)
>
Correct. It outputs at least the first char of a non-extendable line or
the newline after it if that line is empty.
By the way, what these programs don't check is if the first line is a
single character. The challenge statement is unclear on if the first
line should be seen as an extension of a ghost empty line or not.
Thread Previous
|
Thread Next