I am trying to write a script that will go through a small text file line by line. It should create a list of tuples that have the date as the first entry and all text and white space up until the next date as the second tuple entry. Then repeat until the file is exhausted.
If this is the contents of the text file:
2018-01-01
Stuff.
More Stuff.
2018-01-02
Different stuff.
Then the output should be:
[("2018-01-01", "Stuff.\n\nMore stuff."), ("2018-01-02", "Different Stuff.")]
I am using Pythex. My regex is: (\d{4}-\d{2}-\d{2})(.|\n|\r)*?
It matches all of the dates, but it never matches the empty lines or text.
I have the MULTILINE
flag set in Pythex.
I have also tried setting DOTALL
but it still does not grab anything other than the dates.