fork download
  1. import re
  2. l=['Milk (regular) (1 gallon)', 'Loaf of Fresh White Bread (1 lb)', 'Rice (white) (1 lb)', 'Eggs (regular) (12)', 'Local Cheese (1 lb)']
  3. for s in l:
  4. m = re.search(r'^[a-z]+(?:\s+[a-z]+)*', s, re.I)
  5. if m:
  6. print(m.group())
Success #stdin #stdout 0.03s 9588KB
stdin
Standard input is empty
stdout
Milk
Loaf of Fresh White Bread
Rice
Eggs
Local Cheese