I have a text file like the following which I am trying to create some regex for in Python:
CR INFO
CR INFO
Wed Aug 17
foo-bar name_10_Name-Child_test
foo-bar name_25_Name-out
foo-bar name_1000_Name-test_out
CR INFO
CR INFO
Wed Aug 17
foo-bar name_10_Name-Child_test
foo-bar name_25_Name-out
foo-bar name_1000_Name-test_out
Now I'm fairly new to regex so apologies if this is very simple.
I'm trying to capture the lines starting with foo-bar, and grouping them together. So for example, the 3 foo-bar lines in one group, then the 3 below the date go in to another.
I so far have the following regex (^foo-bar\s+[A-z0-9-]+) but that matches every foo-bar line to an individual group, rather than having 3 in one group. Regex flags on regex101.com are gm.
How can I group the 3 lines together until it meets either the "CR" string, or a double new line?
Many thanks.