Replace Invalid Characters

Any questions? Need some help?
Post Reply
User avatar
666de666
Posts: 2
Joined: 26 Mar 2014, 13:14

Replace Invalid Characters

Post by 666de666 »

Hello,
Is there a possible way to replace the invalid characters in name while renaming with another characters? For example, when renaming we see that :, ? etc. are invalid characters... so Filebot omits those characters. Now, instead of deleting those characters, can I replace colon (:) with dash (-) or question mark (?) with a exclamation mark (!) and so on?

Thank you in advance. ;)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Replace Invalid Characters

Post by rednoah »

Yes.

e.g.

Code: Select all

{t.replaceAll(/[`´‘’ʻ]/, "'")}
You will find numerous other examples in the docs.
:idea: Please read the FAQ and How to Request Help.
User avatar
666de666
Posts: 2
Joined: 26 Mar 2014, 13:14

Re: Replace Invalid Characters

Post by 666de666 »

Worked like a charm. Thank you very much.
kolwe1984
Posts: 2
Joined: 11 Mar 2018, 09:37

Re: Replace Invalid Characters

Post by kolwe1984 »

Hi,

first, sorry for my bad english, I'm from Germany.
Thanks for your fine program, everything works fine, but I don't get it where I have to post the code you've mentioned above.

I would like to rename my films like this:

Original: Thor: Ragnarök
I would like to have it like this: Thor - Ragnarök.

So the ':' should be changed to ' -' with a blank before the line '-'

How can I do this?
Thank you very much for your help.
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Replace Invalid Characters

Post by rednoah »

Sure, the {plex} format does what you want by default.

The first built-in movie format example does exactly that as well:

Code: Select all

n.colon(' - ')
What format are you using?
:idea: Please read the FAQ and How to Request Help.
kolwe1984
Posts: 2
Joined: 11 Mar 2018, 09:37

Re: Replace Invalid Characters

Post by kolwe1984 »

Oh, I'm so stupid... ^^'
Now, I think I've got it right. The format I'm using is: {n.colon(' - ')} ({y})
That should be fine, right now.

Thanks for your help :)
User avatar
rednoah
The Source
Posts: 22974
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Replace Invalid Characters

Post by rednoah »

:idea: Please read the FAQ and How to Request Help.
Post Reply