# Character remapping during conversion?

**URL:** https://community.mp3tag.de/t/character-remapping-during-conversion/13037
**Category:** Support
**Created:** [February 1, 2012, 6:36pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037 "2012-02-01T18:36:43Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![deckard](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/bbce88/32.png) [@deckard](https://community.mp3tag.de/u/deckard)
#### Post date: [February 1, 2012, 6:36pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/1 "2012-02-01T18:36:43Z")

</div>

Hi - I would like to know if there is a way to have certain characters remapped when I convert Tag \> Filename. Ideally, I would like a template that I could use to create an action group so that I could add more characters as I need them. However, I don't see how to do this. I can obviously create a "replace" function, but this would not help me when converting. I see this on the Help page:  
  
**Remove invalid characters from file name/file paths**

Command: $validate(filename,to)  
Example: $validate(%artist% - %album% - %track% - %title%,-)  
This example replaces all invalid characters (/?\*"\<\>|:slight\_smile: to dashes.

This is sort of what I want, except I want to make it so that each one of those invalid characters gets changed to something else that I choose.

BTW, can the example above just be entered in the format string field when converting Tag \> Filename? The help file sort of indicates this, but it does not do what is expected.

I did look at the regular expression threads in the forum, but again, I still don't know how I would make something like this happen only when converting.

Thanks!

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 1, 2012, 6:58pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/2 "2012-02-01T18:58:50Z")

</div>

> [@deckard](#):
>
> Hi - I would like to know if there is a way to have certain characters remapped when I convert Tag \> Filename. ...  
> Command: $validate(filename,to)  
> Example: $validate(%artist% - %album% - %track% - %title%,-)  
> This example replaces all invalid characters (/?\*"\<\>|:slight\_smile: to dashes. [/b]
> 
> This is sort of what I want, except I want to make it so that each one of those invalid characters gets changed to something else that I choose.

The function $validate() is able to make a text string valid to be used as a name in the filesystem.  
If that is, what you want to do, then use this function.

Otherwise characters or strings can be replaced by the functions $replace() or $regexp(), or by the actions "Replace", "Replace with Reglar Expression".

You should be more specific what you really want to achieve.

DD.20120201.2059.CET

---

<div class="post-metadata">

### Author: ![deckard](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/bbce88/32.png) [@deckard](https://community.mp3tag.de/u/deckard)
#### Post date: [February 1, 2012, 7:17pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/3 "2012-02-01T19:17:41Z")

</div>

> [@DetlevD](#):
>
> The function $validate() is able to make a text string valid to be used as a name in the filesystem.  
> If that is, what you want to do, then use this function.
> 
> Otherwise characters or strings can be replaced by the functions $replace() or $regexp(), or by the actions "Replace", "Replace with Reglar Expression".
> 
> You should be more specific what you really want to achieve.
> 
> DD.20120201.2059.CET

Hi and thanks for replying - OK, an example of what I want to do is this:

If the title of the track in the tag is: Open/Close

When I convert from Tag \> Filename, I want it to be: Open-Close

I want this to be automatic, so whenever I convert Tag \> Filename, this will occur, and any other invalid characters can be remapped to something else as well (colon to semicolon, quotes to 2 single quotes, etc.). A global setting for character remapping when naming files would be ideal.

I am confused as to how I could use a replace action to accomplish this, since this would only be required on a conversion. In other words, what is there to replace in a filename if the character only exists in the tag?

Please let me know if this is clear or not. Thanks again!

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [February 1, 2012, 7:35pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/4 "2012-02-01T19:35:39Z")

</div>

If you want to convert the filenam to: %artist% - %title%.mp3 with your replaces, use the following for the converter:  
$replace(%artist% - %title%,/,-,:,;,",'''')  
You can expand that list of replacement for all characters you want.  
Note that you have to use four single quotes instead of two, because the have to be "escaped" from the Mp3tag script syntax.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 1, 2012, 7:38pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/5 "2012-02-01T19:38:08Z")

</div>

> [@deckard](#):
>
> ... whenever I convert Tag \> Filename, this will occur, and any other invalid characters can be remapped to something else as well (colon to semicolon, quotes to 2 single quotes, etc.). A global setting for character remapping when naming files would be ideal.  
> ...

**$validate** 

Usage: $validate(,)

 

Following invalid characters will be replaced with ReplaceChar:  
034 "  
042 \*  
047 /  
058 :  
060 \<  
062 \>  
063 ?  
124 |

 

"\*/:\<\>?|

 

$validate allows the colon to exist at position 2 counted from the left edge of the string, when used as the separator for the drive letter.

 

"E:\abc"  
... is allowed

 

**" E:\abc"  
... is not allowed and will give ...  
" E\_\abc"**

 

Examples:

  **Clean Path $validate($regexp('x ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... x','(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',),'\_') Result = "x ... E\_\Music\_Album 1\_\Artist \_2\_\Title 3 ... x" $validate($regexp(' ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... ','(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',),'\_') Result = "E:\Music\_Album 1\_\Artist \_2\_\Title 3" Note: $validate respects the colon at the second string position. $validate($regexp(' ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... ','(?:^|(?\<=\\\\))[.]+|[.]+(?:(?=\\\\)|$)',),) Result = "E:\Music\Album 1\Artist 2\Title 3" Note: $validate respects the colon at the second string position.**  **$replace** 

The function $replace(,,) is case-sensitive.  
To this function a plurality of 'from,to' pairs can be passed:

 $replace(string,from,to[,from,to]...)

Example:

 **$replace(%TEST%,'ä','ae','ö','oe','ü','ue','Ä','Ae','Ö','Oe','Ü','Ue','ß','ss')** 

DD.20120201.2145.CET

---

<div class="post-metadata">

### Author: ![deckard](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/bbce88/32.png) [@deckard](https://community.mp3tag.de/u/deckard)
#### Post date: [February 1, 2012, 8:14pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/6 "2012-02-01T20:14:14Z")

</div>

> [@pone](#):
>
> If you want to convert the filenam to: %artist% - %title%.mp3 with your replaces, use the following for the converter:  
> $replace(%artist% - %title%,/,-,:,;,",'''')  
> You can expand that list of replacement for all characters you want.  
> Note that you have to use four single quotes instead of two, because the have to be "escaped" from the Mp3tag script syntax.

Thank you! This is exactly what I was looking for. I have just changed my default convert strings to include this. Saves a LOT of time! Much appreciated.

---

<div class="post-metadata">

### Author: ![deckard](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/bbce88/32.png) [@deckard](https://community.mp3tag.de/u/deckard)
#### Post date: [February 1, 2012, 8:23pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/7 "2012-02-01T20:23:16Z")

</div>

> [@DetlevD](#):
>
> **$validate** 
> 
> Usage: $validate(,)
> 
>  
> 
> Following invalid characters will be replaced with ReplaceChar:  
> 034 "  
> 042 \*  
> 047 /  
> 058 :  
> 060 \<  
> 062 \>  
> 063 ?  
> 124 |
> 
>  
> 
> "\*/:\<\>?|
> 
>  
> 
> $validate allows the colon to exist at position 2 counted from the left edge of the string, when used as the separator for the drive letter.
> 
>  
> 
> "E:\abc"  
> ... is allowed
> 
>  
> 
> **" E:\abc"  
> ... is not allowed and will give ...  
> " E\_\abc"**
> 
>  
> 
> Examples:
> 
> **Clean Path $validate($regexp('x ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... x','(?:^|(?\<=\\\\))[.]+|[.]+(?:frowning:?=\\\\)|$)',),'\_') Result = "x ... E\_\Music\_Album 1\_\Artist \_2\_\Title 3 ... x" $validate($regexp(' ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... ','(?:^|(?\<=\\\\))[.]+|[.]+(?:frowning:?=\\\\)|$)',),'\_') Result = "E:\Music\_Album 1\_\Artist \_2\_\Title 3" Note: $validate respects the colon at the second string position. $validate($regexp(' ... E: \ ... Music \ ...\ ... Artist \*2\*\ Title 3 ... ','(?:^|(?\<=\\\\))[.]+|[.]+(?:frowning:?=\\\\)|$)',),) Result = "E:\Music\Album 1\Artist 2\Title 3" Note: $validate respects the colon at the second string position.**  **$replace** 
> 
> The function $replace(,,) is case-sensitive.  
> To this function a plurality of 'from,to' pairs can be passed:
> 
> $replace(string,from,to[,from,to]...)
> 
> Example:
> 
> **$replace(%TEST%,'ä','ae','ö','oe','ü','ue','Ä','Ae','Ö','Oe','Ü','Ue','ß','ss')** 
> 
> DD.20120201.2145.CET

Thank you for this! It will definitely come in handy. I clearly have some reading to do...

---

<div class="post-metadata">

### Author: ![matt\_t](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/7cd45c/32.png) [@matt\_t](https://community.mp3tag.de/u/matt_t)
#### Post date: [February 2, 2012, 11:05pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/8 "2012-02-02T23:05:24Z")

</div>

**Remove invalid characters from file name/file paths**

Command: $validate(filename,to)  
Example: $validate(%artist% - %album% - %track% - %title%,-)  
This example replaces all invalid characters (/?\*"\<\>|:slight\_smile: to dashes.

How can I modify

$validate(%track%-%title%,-)

to pad the track number to two characters? I have tried but failed dismally. 😛 Thanks in advance.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 3, 2012, 4:59am UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/9 "2012-02-03T04:59:28Z")

</div>

> [@Matt](#):
>
> [b]Remove invalid characters from file name/file paths Command: $validate(filename,to) ... How can I modify ... to pad the track number to two characters? ...

Matt, the theme of this thread is "Character remapping during conversion?" but not how to pad a track number.  
Please post your question under your own thread and do not hijack this thread.  
Please read the FAQ area.  
Please read the forum, you will find answers to your question every two days, at least evey week back in time.  
As April 2009 registered user you should know this by yourself.  
Maybe there is an answer ...  
[[F] problems with ":" when renaming file](https://community.mp3tag.de/t/8205/5)

I beg your pardon for my rude words.  
Why do you post a citation from the FAQ area regarding function $validate here in this thread and ask a non relevant question about the function $num ? ? ?

DD.20120203.0700.CET

---

<div class="post-metadata">

### Author: ![deckard](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/bbce88/32.png) [@deckard](https://community.mp3tag.de/u/deckard)
#### Post date: [February 3, 2012, 12:56pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/10 "2012-02-03T12:56:18Z")

</div>

Hey guys - I just noticed I spelled "Remapping" wrong in the thread title. Is there any way to correct it so this helpful thread will show up if someone searches for the same terms? Thanks!

---

<div class="post-metadata">

### Author: ![deckard](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/bbce88/32.png) [@deckard](https://community.mp3tag.de/u/deckard)
#### Post date: [February 3, 2012, 3:15pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/11 "2012-02-03T15:15:49Z")

</div>

That was fast - thanks!

---

<div class="post-metadata">

### Author: ![matt\_t](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/7cd45c/32.png) [@matt\_t](https://community.mp3tag.de/u/matt_t)
#### Post date: [February 3, 2012, 4:53pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/12 "2012-02-03T16:53:20Z")

</div>

> [@DetlevD](#):
>
> Matt, the theme of this thread is "Character remapping during conversion?" but not how to pad a track number.  
> Please post your question under your own thread and do not hijack this thread.  
> Please read the FAQ area.  
> Please read the forum, you will find answers to your question every two days, at least evey week back in time.  
> As April 2009 registered user you should know this by yourself.  
> Maybe there is an answer ...  
> [[F] problems with ":" when renaming file](https://community.mp3tag.de/t/8205/5)
> 
> I beg your pardon for my rude words.  
> Why do you post a citation from the FAQ area regarding function $validate here in this thread and ask a non relevant question about the function $num ? ? ?
> 
> DD.20120203.0700.CET

Detlev, could you not have simply answered my question in about 1% of the number of characters you used to be unpleasant to me? In the past you have been helpful, and I have been polite and appreciative, but this leaves a sour taste with me.

Also please remember that not everyone is a super genius like yourself. Most of this stuff looks like Chinese to some people. If you see someone asking a question very similar to your own, sometimes you have to grab at that straw.

In fact, basically I was asking _the same question_ in as the original post, with the proviso that it doesn't mess up my usual practice of having 2-digit track numbers!!

So I modifed this line from the original post:

**Example: $validate(%artist% - %album% - %track% - %title%,-)**

to:

$validate(%track%-%title%,-)

and asked a question about what to do next! What's so irrelevant about that?

[And BTW in fact I found the original post by ... searching!!]

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 3, 2012, 5:55pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/13 "2012-02-03T17:55:15Z")

</div>

> [@Matt](#):
>
> ... In fact, basically I was asking _the same question_ in as the original post ...

Hmm, I did read a different question from you, than the question from the open poster, who asked for "Character remapping".  
You asked for ...

> [@](#):
>
> How can I ... pad the track number to two characters?

On some days I'm just too tired to answer the same simplest questions over and over again.

Matt, in your case, one got the feeling to have been intentionally kidded, because the answer to your own question is in your own post (see citation link above, pointing to your post).

If you are not able to understand your own example in your own post, then try to understand the example in Mp3tag Manual  
[https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting)  
Topic  
**Pad decimal number with leading zeros**

DD.20120203.2000.CET

---

<div class="post-metadata">

### Author: ![matt\_t](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/7cd45c/32.png) [@matt\_t](https://community.mp3tag.de/u/matt_t)
#### Post date: [February 3, 2012, 7:29pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/14 "2012-02-03T19:29:07Z")

</div>

[quote name='DetlevD' post='61517']  
Hmm, I did read a different question from you, than the question from the open poster, who asked for "Character remapping".  
You asked for ...

Yes, the original post asked for character remapping, and I was asking about character remapping so it conforms to my usual practice, i.e. asking a related follow-up question. So shoot me.

**On some days I'm just too tired to answer the same simplest questions over and over again.**  
   
They may be simple to you but not necessarily to everyone else. I am not ashamed to say I don't understand and ask for help. You can be a genius, but that doesn't mean you have to bite the head off someone less knowledgeable than yourself.

**Matt, in your case, one got the feeling to have been intentionally kidded, because the answer to your own question is in your own post (see citation link above, pointing to your post).**

OK, so I asked that question before, a long time ago, and since a lot of water has gone under the bridge since then I had forgotten. Funny how that post didn't come up no.1 in my search result, whereas this thread did. Maybe you could have just have given a little wink and reminded me. Remember patience is a virtue, and a bit of good humour doesn't hurt too.

And yes, I'm too stupid to work out how to quote properly, hence the bold letters.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 4, 2012, 1:18pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/15 "2012-02-04T13:18:55Z")

</div>

> [@Matt](#):
>
> Detlev, could you not have simply answered my question in about 1% of the number of characters you used to be unpleasant to me? ...

Hmm ... _about 1% of the number of characters_? ==\> **read FAQ**

DD.20120204.1520.CET

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/character-remapping-during-conversion/13037/16 "2026-02-09T12:23:38Z")

</div>


