i have the following text :
- The first Heading This is heading 1 data
- The second header : this is heading 2 data
- third header this is heading 3 data
So, i am trying to write a single regex. i know for a fact that to extract data between heading 1 and heading 2, the following regex will work
The first Heading(.*?)The second header
The above will give the text "This is heading 1 data". But, what i am trying to get is to look for all the heading's that is a regex, which will return a list as follows
["This is heading 1 data","This is heading 2 data","This is heading 3 data"]
What i had in mind was the following
The first Heading(.*?)The second header(.*?)third header (.*?)
But, i am not getting any data for the above regex. can anyone help me with the solution
DOTALLmode as you have linebreaks (at least in your sample).re.split(r'[\r\n]+(?:{})(?:\s*:)?\s*'.format('|'.join(my_heading_list)), s)