Question above do not actual now. Now I have got next problem.

import std.stdio;
import std.regex;
import std.file;

void main()
{
    auto text = "#Header
    my header text

    ##SubHeader
    my sub header text

    ###Sub3Header
    my sub 3 text

    #Header2
    my header2 text";

auto l1 = regex(`(^|\n)#([^#]*)\n([\^]*)(?=\n#[^#]|$)`, ['g', 'm']);

    foreach(t; text.matchAll(l1))
    {
        writeln(t.hit);
    }
}


This code is print to console:

#Header
my header text

How can I modify regex to get it print:

#Header
my header text

##SubHeader
my sub header text

?

I tried different combination, some of them are working in online regexp editors, but do not working in D.

Reply via email to