I'd like some assistance with some regex that's been bothering me for quite some time.
I'm trying to rename files with this format:
- Code: Select all
Pielikers - 01x01 - I Like Pie.DIMENSION.English.C.updated.Addic7ed.com.srt
This works fine using following regex:
- Code: Select all
(.*) - (\d\d)x(\d\d) - ([^\.]*)
\1 S\2E\3 \4
However some series titles contain ".", for example:
- Code: Select all
Person of Interest - 04x13 - M.I.A..DIMENSION.English.C.updated.Addic7ed.com.srt
Which leaves me with:
- Code: Select all
Person of Interest S04E13 M.srt
The only characteristic I can find in ".DIMENSION.English.C.updated.Addic7ed.com.srt" is the fact that the sequence starts with a dot and that the whole sequence does not contain any spaces (whitespace) at all.
Several parts in that sequence may change, the "DIMENSION", "English", "C", "updated", all those can change, maybe they can add more fields to the file name, who knows.
I mean I could hardcode it all (for example, look for 6 dots at the end and take everything before that), but maybe some field also contains a dot...
- Code: Select all
(.*) - (\d\d)x(\d\d) - (.*)(\..*){6}
is there a simple way to retrieve my title in both the general case and the special case where the title contains spaces?
Thanks in advance!