fork download
  1. import re
  2.  
  3. def getEpisode(filename):
  4. return re.search(r"\b(?:e(?:p(?:isode)?)?|x)?\s*(\d{2,3})\b", filename, re.IGNORECASE)
  5.  
  6. episodes = [
  7. "Terkel in Trouble 2004",
  8. "eisode11",
  9. "episode12",
  10. "e13",
  11. "ep14",
  12. "EP999 this is x888",
  13. " 234",
  14. "235"
  15. ]
  16. for episode in episodes:
  17. match = getEpisode(episode)
  18. if match:
  19. print(match.group(1))
Success #stdin #stdout 0.02s 9768KB
stdin
Standard input is empty
stdout
12
13
14
999
234
235