by Glenn » Mon Oct 20, 2008 8:25 pm
You haven't explained what exactly you are using in your Match and replace.
The regular expression you show matches the season/episodes for the sample filenames, but the first alternation,
s0?(\d\d?)e([\d]{2})
will match
S01E01
Why would you want to match a filename that is already in the correct format?
You should try to match only filenames which are incorrect and change those.
You also have to understand that Bulk Rename works a little differently in how it uses the match/replace than normal regex Search/replace. You must capture ALL parts of the filename that you want to retain, not just those to be changed.
From you regex, I deduce that the episode is always going to have 2 digits, and the season will be 1 or 2.
I am assuming you may have Season/episode numbers such as s1x01, 1e01, s101 etc.
Also I assume s and e can be either upper or lower case
To simplify this as much as possible it's probably easiest not to capture existing S or E and supply our own in replacement.
This reduces it to adding S and E to 2 digit seasons, and adding S0 and E to one digit seasons.
This means you will have to make 2 renaming passes, one for each.
In order to not match correct filenames we use negative lookahead
(?!S\d{2}E\d{2})
To ignore case we use
(?i)
So, use this as you first pass
single digit season
Match
(?i)(.+?\.)(?!S\d{2}E\d{2})\D?(\d)\D?(\d{2}\..*)+
Replace
\1S0\2E\3
Then use this as your second pass
double digit season
Match:
(?i)(.+?\.)(?!S\d{2}E\d{2})\D?(\d{2})\D?(\d{2}\..*)+
Replace:
\1S\2E\3
This should work if all the filenames are similar to the samples you supplied.
Regex forum posters often forget to include examples of all possibilities and if this is the case you will have to modify it to suit the new criteria.
Anyway, this should get you started.
Cordially,
Glenn