fork(1) download
  1. import re
  2. text = """Pos no
  3. ...
  4. ... 25/gm
  5. The Text to be
  6. ...
  7. excluded
  8. Pos no
  9. ...
  10. ... 46 kg
  11. The Text to be
  12. ...
  13. excluded
  14. Pos no
  15. ...
  16. ... 46 xunit
  17. End of My Text"""
  18. print(re.findall(r'(?sm)(Pos no\r?\n.+?)[\r\n]+(?:The Text to be|End of My Text)', text))
Success #stdin #stdout 0.02s 6808KB
stdin
Standard input is empty
stdout
['Pos no\n...\n... 25/gm', 'Pos no\n...\n... 46 kg', 'Pos no\n...\n... 46 xunit']