Batch-Renaming Movies using Regex

Posted by Nate Mara on Super User See other posts from Super User or by Nate Mara
Published on 2013-10-29T03:30:15Z Indexed on 2013/10/29 3:59 UTC
Read the original article Hit count: 602

Filed under:
|

So, I've been trying to rename some movie files using regular expressions, but so far I have been only marginally successful. The goal is to parse files like this:

2001.A.Space.Odyssey.1968.720p.BluRay.DD5.1.x264-LiNG.mkv

And rename them Like this:

2001 A Space Odyssey (1968).mkv


I created the pattern: ^(.+).(\d{4}).+.(mp4|avi|mkv)$

With the output: \1 (\2).\3

Now, this works perfectly fine when I have movies with one-word titles, but when there is more than one word separated by a period, the regex fails to grab anything.


What am I doing wrong here?

© Super User or respective owner

Related posts about regex

Related posts about batch-rename