fork download
  1. import re
  2.  
  3. regx = r"\b(?:soy|almond)\s?milk\b|\b(milk)\b"
  4.  
  5. food = "is combined with creamy soy and milk. a fruity and refreshing sip of spring, "
  6. print(re.findall(regx, food))
  7.  
  8. food = "is combined with creamy milk. a fruity and refreshing sip of spring, "
  9. print(re.findall(regx, food))
  10.  
Success #stdin #stdout 0.03s 9340KB
stdin
Standard input is empty
stdout
['milk']
['milk']