Suppose I have a text containing following (two) sections:
Section1
,111,
,222,
,333,
Section2
,444,
,555,
,666,
I want to match only the items from section one, e.g. 111, 222 and 333.
I tried something like: ,\d+,.*(?=Section2) but, of course this is matching everything till Section2, and I’m not sure how to tell it to match separate groups. Note that Section1 can have more items than in the example above.
EDIT:
I now get what I want with ,\d+,(?=.*Section2).
use this regex
(?is)(?<=Section\d+)(.+?)(?=((Section)|($)))for separate values into sectionsuse this regex
\d+for parse sections