[SNIPPET] Replace Characters, Words or Patterns

All about user-defined episode / movie / file name format expressions
Post Reply
User avatar
rednoah
The Source
Posts: 23469
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[SNIPPET] Replace Characters, Words or Patterns

Post by rednoah »

e.g. Replace custom text:

Format: Select all

{ n.replace('apple':'orange') }


e.g. Strip : and - and replace & with and:

Format: Select all

{ n.replace(':':'', '-':'', '&':'and') }


e.g. Replace German Umlauts:

Format: Select all

{ n.replace(ä:'ae', ö:'oe', ü:'ue') }


e.g. Read replacement map from an external CSV or TSV file:

Format: Select all

{ n.replace(csv('/path/to/replace.csv')) }

Console Output: Select all

$ cat ~/replace.csv
ä	ae
ö	oe
ü	ue





e.g. Remove all patterns in (...) round brackets:

Format: Select all

{ fn.removeAll(/\(.+?\)/) }
e.g. Remove all patterns in [...] square brackets:

Format: Select all

{ fn.removeAll(/\[.+?\]/) }
:arrow: See Strip brackets [...] from the file path for details.
:idea: Please read the FAQ and How to Request Help.
Post Reply