fork download
  1. import re
  2. teststr= 'chapter 1 Here is a block of text from chapter one. chapter 2 Here is another block of text from the second chapter. chapter 3 Here is the third and final block of text.'
  3. print( re.split(r'(?!^)(?=chapter \d)', teststr) )
Success #stdin #stdout 0.02s 9504KB
stdin
Standard input is empty
stdout
['chapter 1 Here is a block of text from chapter one.  ', 'chapter 2 Here is another block of text from the second chapter.  ', 'chapter 3 Here is the third and final block of text.']