fork download
  1. import re
  2. p = re.compile(r'Enter([^.]*)')
  3. test_str = "Scena Secunda.\n\nAlarum within. Enter King Malcome, Donalbaine, Lenox, with\nattendants,\nmeeting a bleeding Captaine.\n\n King. What bloody man is that? he can report,\nAs seemeth by his plight, of the Reuolt\nThe newest state"
  4. print(p.findall(test_str))
  5. print(p.search(test_str).group())
  6. print(re.findall(r'Enter[^.]*', test_str))
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
[' King Malcome, Donalbaine, Lenox, with\nattendants,\nmeeting a bleeding Captaine']
Enter King Malcome, Donalbaine, Lenox, with
attendants,
meeting a bleeding Captaine
['Enter King Malcome, Donalbaine, Lenox, with\nattendants,\nmeeting a bleeding Captaine']