This regex won't work correctly if you have \r\n
newlines in your input text.
The part (?:\r|\n?)
matches either an \r
or an \n
, but not both. (regex101 treats newlines as \n
only, so it works there).
Does the following work?
/(?:(?:(?:^[+*-] )(?:[^\r\n]+))[\r\n]*)+/m
(or, after removal of all the unnecessary non-capturing groups - thanks @M42!)
/(?:^[+*-] [^\r\n]+[\r\n]*)+/m