Replacing a colon with a dash

Any questions? Need some help?
Post Reply
jacox
Posts: 7
Joined: 16 Feb 2014, 15:57

Replacing a colon with a dash

Post by jacox »

I have FileBot set up to rename my movie folders and filenames correctly using the following expression:

Code: Select all

//Volumes/Movies/{n} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{vc}
However, I am running into a small problem when I have movies like this: Seal Team Six: The Raid on Osama Bin Laden

As you can see, there is a colon in the filename which is an illegal character. FileBot notifies me of this and replaces it with a valid character. I want to replace the colon with a dash though. From what I've read this is the way to do so:

Code: Select all

.replaceAll(/[:|]/, " - ")
This doesn't work though, and I'm not sure where to put it. I want to retain the uppercase format for the movie folder name. How do I strip the colon and replace with a dash?
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: Replacing a colon with a dash

Post by Ithiel »

Hi jacox,

Yup, that's the correct bit of code to fix the problem, however you need to make sure you add it to both the folder name and the show name.

That should make it something like this:

Code: Select all

//Volumes/Movies/{n.replaceAll(/[:|]/, " - ")} ({y})/{n.replaceAll(/[:|]/, " - ").upperInitial().space('.')}.{y}.{vf}.{vc}
Let me know if that helps :-)
There can be only one Power² User
User avatar
rednoah
The Source
Posts: 20487
Joined: 16 Nov 2011, 08:59

Re: Replacing a colon with a dash

Post by rednoah »

e.g.

Code: Select all

{ n.colon(' - ') }
:idea: Please read the FAQ and How to Request Help.
Post Reply