so have text in markdown i'd split between headers string array, including content between headers. following example:
**header 1**lots of text here.\n**header 2**more , more text here..\n**header 3** etc..
what i'd end array of:
**header 1**lots of text here.\n **header 2**more , more text here..\n **header 3** etc..
what i'm trying along lines of (?<=\*{1,10}.\{1,10}) although think somewhere in there should [^*{2}] include every char max of 2 *'s (the close of header). \n not guaranteed before header i'm little bit stumped how this.
any appreciated :)
you can try lookaheads based regex matching:
((?:\*\*.+?(?=\*\*|$)){2,})
(?=\*\*|$)
positive lookahead assertion match text until hit\*\*
or end of line.- range of
{2,}
ensure @ least 2**
in matched text - captured group #1 text you're interested in
Comments
Post a Comment