fork download
  1. import re
  2. newtxt="200 sample text with many lines\n hell01 \n hell02 \n hell03 \n hell04 \n hell05\n hell06\n hell07 \n hell08"
  3. pattern = re.compile(r'^\d{3} [a-z].*((?:\r?\n.*){0,5})', re.M)
  4. m = pattern.search(newtxt)
  5. if m:
  6. print( m.group(1) )
Success #stdin #stdout 0.02s 9616KB
stdin
Standard input is empty
stdout
 hell01 
 hell02 
 hell03 
 hell04 
 hell05