I want to split my text by subparts 1., 2., ...
import re
s = "1. First sentence. \n2. Second sentence. \n1. Another sentence. \n3. Third sentence."
l = re.compile('\n(?=[0-9].)').split(s)
With my regex I get:
['1. First sentence. ', '2. Second sentence. ', '1. Another sentence. ', '3. Third sentence.']
But I want to split only if the number is superior to the previous one
['1. First sentence. ', '2. Second sentence. 1. Another sentence. ', '3. Third sentence.']
For this example I want a list of 3 elements and not 4.