fork(1) download
  1. import re
  2. p = re.compile(r'abc(?:(?!abc|xyz|123).)*123(?:(?!abc|xyz).)*xyz', re.DOTALL)
  3. s = "abc 123 xyz\nabc abc 123 xyz\nabc text 123 xyz\nabc text xyz xyz"
  4. print(p.findall(s))
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
['abc 123 xyz', 'abc 123 xyz', 'abc text 123 xyz']