I want to parse the following statement using regex:
(o) Multi
line
text
(o) Single line text
(o) Single line text
When I use the following regex, the whole text of the source is captured:
(?<bullet>\(o\)\ ) (?<text>.+)
What I want to achieve is having three matches of text group, ie.
Multi
line
text
and then twice Single line text.
If the solution is lookahead/behind, how to use it to achieve this?
Thanks.
You could use lookahead to check for the next (o) or end of input
(?<bullet>\(o\)) (?<text>.*?)(?=\(o\)|$)