There is this regex to capture markdown title and conten, from Obsidian to anki plugin.
https://github.com/ObsidianToAnki/Obsidian_to_Anki/wiki/Header-paragraph-style
^#+(.+)n*((?:n(?:^[^n#].{0,2}$|^[^n#].{3}(?<!<!–).*))+)
It works but stops when there is an empty new line.
I’ve been tinkering with it to see if I could change it so it doesn’t stop capturing on an empty line.
Please, can anyone explain what the regex does?
See original
https://regex101.com/r/IotYiZ/2
I’ve tried removing n from expresion but messes up with nested titles.
(With X so it’s pretty)
/^#+(.+)n*
(
(?:n(?:^[^#].{0,2}$
|^[^#].{3}
(?<!<!--).*
)
)+
)/gmx