I'm trying to match some URLS as a proof of concept using Golang. I'm not the best with regular expressions, I need something that matches anything with either a season number or episode number following a backslash. Here's an example:
https://URL.com/program/something-a/s1/e1/title
https://URL.com/program/something-a/e12/title
The seasons can go up to double figures (/s12
, /s13
), and the episodes up to three (e.g. /e100
). What's the best way to do this?
Edit: So here's what I tried so far:
(\/s.\/)
or
(\/e.\/)
Seems to work for single figures, but not when you get up to something like /e12/
etc. When I try to find something that matches both, like
(\/s[0-9][0-9]\/)
it doesn't pick up episodes or series with only a single number (e.g. /s2/
).
how it works
...and then there is another sequence but for 3 digits, not 2