persistent byLine

Nick Treleaven ntrel-public at yahoo.co.uk
Fri Jul 26 08:19:18 PDT 2013


On 24/07/2013 18:53, Jakob Ovrum wrote:
> On Wednesday, 24 July 2013 at 17:26:58 UTC, Peter Alexander wrote:
>> On Wednesday, 24 July 2013 at 17:13:10 UTC, Jakob Ovrum wrote:
>>>     auto newlinePattern = ctRegex!"[\r\n]+";
>>
>> That will swallow empty lines.
>
> Yeah, it's just an example. The specific pattern obviously depends on
> the exact behaviour you want, but I think any desired behaviour
> regarding newlines can be trivially expressed with regex.

Nice idea, I wasn't aware of regex splitter. I'll try using:

auto newlinePattern = ctRegex!"\r\n|\r|\n";

In fact, if we add unicode line & paragraph separators to the pattern 
(like std.string.splitLines), that literal might be worthy of adding to 
std.regex.


More information about the Digitalmars-d mailing list