fork download
  1. import re
  2.  
  3. pattern = r"^efgh\b(?!\.).*"
  4.  
  5. s = ("abcd|123|ABCD|112233|\n"
  6. "abcd|234|ABCD|112233|\n"
  7. "abcd.abc|123|ABCD|112233|\n"
  8. "efgh|234|EFGH|445566|\n"
  9. "efgh|4567|EFGH|445566|\n"
  10. "efgh.abc|6789|EFGH|445566|\n"
  11. "efgh.abc|4567|EFGH|445566|\n"
  12. "xyz|567|XYZ|557799|\n"
  13. "xyz.abc|567|XYZ|557799|")
  14.  
  15. print(re.findall(pattern, s, re.M))
Success #stdin #stdout 0.03s 9488KB
stdin
Standard input is empty
stdout
['efgh|234|EFGH|445566|', 'efgh|4567|EFGH|445566|']