Timeline for In Search of a Soulmate
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 12, 2017 at 12:02 | comment | added | Neil | Sorry, that's what I meant by "drops the last one" - it returns one fewer empty line, but then you can't distinguish between 0 and 1. | |
Oct 12, 2017 at 11:59 | comment | added | Martin Ender |
@Neil No, I mean that the output of A is identical regardless of whether it retains a single empty line or discards all lines.
|
|
Oct 12, 2017 at 11:58 | comment | added | Neil |
Matching a single empty line is easy - that's just ^$¶ .
|
|
Oct 12, 2017 at 10:39 | history | edited | Martin Ender | CC BY-SA 3.0 |
added 186 characters in body
|
Oct 12, 2017 at 10:38 | comment | added | Martin Ender |
@Neil Thanks, the limit is a neat idea. I also tried using A`. , but the problem is rather that you can't distinguish a single empty line from having no lines at all. Maybe I should consider terminating A and G output with a linefeed if there are any lines. Although that should probably be an option since I can imagine that linefeed being annoying in other scenarios.
|
|
Oct 12, 2017 at 9:00 | comment | added | Neil |
Save a byte by limiting the newline match to 2, so that the input to the third line is always 0, 1, or 2, simplifying the test. (Annoyingly you can't use A`. to count newlines, because it drops the last one.)
|
|
Oct 11, 2017 at 20:31 | history | edited | Martin Ender | CC BY-SA 3.0 |
added 69 characters in body
|
Oct 11, 2017 at 20:20 | history | answered | Martin Ender | CC BY-SA 3.0 |