ReNamer:Rules:Replace
Replace Rule
This rule removes the specified string from the name and replaces it with another string. It has options to replace the first occurrence, the last occurrence, or all the occurrences. You can replace multiple strings at a time. You can also use wildcards to create simple patterns.
The parameters are as follows:
Parameter | Details |
---|---|
Find | Enter the string to be replaced.
|
button | Inserts a separator (*|*) sequence between two delimiter entries.
In that case, the nth entry in the Find field is replaced by the nth entry in the Replace field. |
Replace | Enter strings that will replace the "Find" strings.
Note that the number of strings (separated with *|*) in "Find" and "Replace" fields should be the same. If there is more strings in the "Find" field than in the "Replace" field the spare strings will be removed (replaced with an empty string). If there is more strings in the "Replace" field, the spare strings will be ignored. |
Insert meta tag | Click the button to see a list of meta-tags. |
Occurrences | In case that strings occur more than once in the filename, specify which occurrences should be replaced. |
Skip extension | If checked, the file extension will be excluded from the processing and will remain unaffected. |
Case sensitive | Will only remove a specified string from the name if the case matches exactly. |
Whole words only | Remove the subject text only when it is whole word, not a part of another word.
For example, searching for "bar" would not find a match in "foobar" or "bars". |
Interpret symbols as wild cards | Treat certain symbols as Wildcards for matching simple patterns (similar to Regular Expressions). |
Wildcards
Wildcard | Represents | Example |
---|---|---|
any number of characters (including numbers, space, underscores, etc.). | abc* equals abc followed by 0 or more characters. | |
Any single character (including numbers, space, underscores, etc.) | ab?d equals abcd, ab1d, ab d, ab_d, etc. | |
Brackets enclose a set of characters, any one of which may match a single character at that position. | foo[ab]ar equals fooaar and foobar | |
(only within a pair of brackets) denotes a range of characters. | foo[a-z]ar equals fooaar, foobar, foocar, foodar, etc. |
Backreferences allow for reuse of wildcard matches in the Replace field using the $N notation, where $1 is the first wildcard match, $2 is second, and so on.
Examples of the use of backreferences:
Find | Replace | Example Input | Produced Output |
---|---|---|---|
*, *
|
$2 $1
|
Smith, John
|
John Smith
|
Happy ?-th birthday *
|
$2 is $1 years old
|
Happy 5-th birthday Bob
|
Bob is 5 years old
|
Beware of conflicting replacements
If you enter multiple find and replace strings they will be executed as multiple Replace rules, so first string will go first and only after replacing all (or first, or last) occurrences of that string the second string in the Find field will be searched and replaced.
|
|
You may expect the new name to be BAAB.mp3, but it's not. This happens because first all A's are replaced with B's (we get BBBB.mp3) and only then all B's are replaced with A's (and the final result is AAAA.mp3).
If you need to apply character-to-character mappings you should use Translit rule.