fork download
  1. import re
  2.  
  3. regex = r"/[^\d/=\r\n]*(\d)/"
  4. strings = [
  5. "https://f...content-available-to-author-only...y.com/ailments/body/10-home-remedies-for-styes/pageid=2/slide_3/",
  6. "https://f...content-available-to-author-only...y.com/ailments/body/10-home-remedies-for-styes/pageid=2/sno3/",
  7. "https://f...content-available-to-author-only...y.com/ailments/body/10-home-remedies-for-styes/pageid=2/3/",
  8. "https://f...content-available-to-author-only...y.com/ailments/body/10-home-remedies-for-styes/pageid=2/slide/",
  9. "https://f...content-available-to-author-only...y.com/ailments/body/10-home-remedies-for-styes/pageid=2/slide_33/",
  10. "https://f...content-available-to-author-only...y.com/ailments/body/10-home-remedies-for-styes/pageid=2/33/"
  11. ]
  12.  
  13. for s in strings:
  14. matches = re.search(regex, s)
  15. if matches:
  16. print ("Group {groupNum} found at {start}-{end} value:{group}".format(groupNum = 1, start = matches.start(1), end = matches.end(1), group = matches.group(1)))
Success #stdin #stdout 0.01s 7172KB
stdin
Standard input is empty
stdout
Group 1 found at 74-75 value:3
Group 1 found at 71-72 value:3
Group 1 found at 68-69 value:3