Page 1 of 1

Regex Problems with folders/files

PostPosted: Fri Apr 21, 2017 8:15 pm
by FailStyle
I cannot for the life of me figure out how to get a regex to work. I've looked at many examples and answers given here and it's all over my head. I have a large amount of movie files that I need to rename. I have them named USA Title aka World Title Year i.e. "The.Thaw.aka.Arctic.Outbreak.2009". What I need to remove is aka to the first number of the year. So aka*1 or aka*2 . Can anyone help me out?

Re: Regex Problems with folders/files

PostPosted: Fri Apr 21, 2017 9:06 pm
by KenP
To be honest I'm not 100% sure I'm understanding correctly, 2 or 3 examples of what you've got and how you want them to be renamed to is always helpful.

This will rename "The.Thaw.aka.Arctic.Outbreak.2009" to "The.Thaw.2009", in other words it will remove everything from the start of "aka" to the year, if that's not what you want give us a couple of examples and we'll try to sort something out for you :wink:

RegEx (1)
Match: (.*)aka.*(\d{4})
Replace: \1\2

Re: Regex Problems with folders/files

PostPosted: Fri Apr 21, 2017 9:27 pm
by FailStyle
Yes, that is EXACTLY what I was asking for! I will try when I get home and report back, thank you so much!

Re: Regex Problems with folders/files

PostPosted: Fri Apr 21, 2017 10:34 pm
by FailStyle
Ok, so examples would've been much better and EXACT examples would've been best :P
The code works as it should, but I didn't give exact naming convention. Here is exactly what I have:

The.Thaw.aka.Arctic.Outbreak.2009.1080p.Bluray
The.Invention.of.Lying.aka.This.Side.of.the.Truth.2009.480p.DVD


What I Need is:

The.Thaw.2009.Bluray
The.Invention.of.Lying.2009.DVD

I don't care for the resolution part, but I do need to keep the source (DVD or Bluray). Thank you again for your help already!

Re: Regex Problems with folders/files

PostPosted: Fri Apr 21, 2017 11:17 pm
by KenP
This should work.

RegEx (1)
Match: (.*)aka.*(\d{4}\.)(\d*.*\.)?(.*)
Replace: \1\2\4




If you decide you do want to keep the resolution this should work.

RegEx (1)
Match: (.*)aka.*(\d{4}\.)(\d*.*\.)?(.*)
Replace: \1\2\3\4

Re: Regex Problems with folders/files

PostPosted: Fri Apr 21, 2017 11:58 pm
by FailStyle
BEAUTIFUL! That is EXACTLY what I needed. Thank you again so much for your time and effort!