fork download
  1. import re
  2. text="Been on hold for [NUM] minutes at that number, AFTER it wouldn't let me cancel the reservation."
  3. available = re.search(r'\[NUM]\s*(?:hour|minute|time|number|hr|Hr)s?\b|!{2}|\?{2}', text)
  4. if available:
  5. print(available.group())
Success #stdin #stdout 0.02s 9564KB
stdin
Standard input is empty
stdout
[NUM] minutes