I'm trying to capture the show name, episode number, episode title, and resolution if present. Standard def episodes in my collection don't have a resolution suffix.
For the given samples:
Show Name - S01E02 - This Is a High-Def Episode Title - 720p
Show Name - S01E03 - This Is a High-Def Episode Title - 1080p
Show Name - S01E04 - This Is a Standard-Def Episode Title
Show Name - S01E05E06 - This Is a High-Def Double Episode Title - 720p
This is as close as I can get on regex101.com:
(?<show>[\w ]+) - (?<episode>S[0-9]{2}E[0-9]{2}E?[0-9]{0,2}) - (?<title>[\w -]+)(?: - )(?<res>(?:720p)|(?:1080p))
It captures all the ones with resolutions appropriately, but the moment I add a ?
to the last capture group-- which does include the standard def episode-- the title group absorbs the resolution. I think I need to include a negative lookahead in the title group, but I'm not sure how to do that and capture it at the same time. And yes, episode titles can have dashes in them.
Any pointers appreciated. If giving code snippets, I'm writing my renaming script in C#, if it makes any difference. Thanks.