fork(1) download
  1. import re
  2. rx = r"[0-9]+(?:st|[nr]d|th)"
  3. s = "April, 23rd June 1st May 2nd"
  4. print(re.findall(rx, s, flags=re.I))
  5.  
Success #stdin #stdout 0.01s 23352KB
stdin
Standard input is empty
stdout
['23rd', '1st', '2nd']