fork(7) download
  1. import re
  2. text = """abc
  3. 123
  4. def
  5. 356
  6. more text..."""
  7. print( re.findall(r"^123(?s:.*?)^3.*", text, re.M) )
  8. # => ['123\ndef\n356']
  9. print( re.findall(r"^123[\w\W]*?^3.*", text, re.M) )
  10. # => ['123\ndef\n356']
Success #stdin #stdout 0.03s 9388KB
stdin
Standard input is empty
stdout
['123\ndef\n356']
['123\ndef\n356']