# Replace some chars to " - "

**URL:** https://community.mp3tag.de/t/replace-some-chars-to/5057
**Category:** Support
**Created:** [June 23, 2007, 6:24pm UTC](https://community.mp3tag.de/t/replace-some-chars-to/5057 "2007-06-23T18:24:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![lingburg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/b5e925/32.png) [@lingburg](https://community.mp3tag.de/u/lingburg)
#### Post date: [June 23, 2007, 6:24pm UTC](https://community.mp3tag.de/t/replace-some-chars-to/5057/1 "2007-06-23T18:24:12Z")

</div>

Hi  
Im looking for some help, I want to change any of illegal filename chars (like ":", "\*", "", "/", etc) for a " - ".  
Some tags have this chars, and then when I convert Tag to Filename, they are replaced with "". But then I want to replace with " - ".

How can I do that?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [June 23, 2007, 7:00pm UTC](https://community.mp3tag.de/t/replace-some-chars-to/5057/2 "2007-06-23T19:00:31Z")

</div>

Please have a look in the help-file "main\_scripting.html":

_$validate(filename, to)_

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

Thats the "magic" command. 😉

---

<div class="post-metadata">

### Author: ![lingburg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/b5e925/32.png) [@lingburg](https://community.mp3tag.de/u/lingburg)
#### Post date: [June 24, 2007, 12:22am UTC](https://community.mp3tag.de/t/replace-some-chars-to/5057/3 "2007-06-24T00:22:09Z")

</div>

thanks for the answer

but there is a way to replace only ":" and "/" for " - " ?

because tags with "?", for example, I want to leave as "" (blank) in filename.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [June 24, 2007, 7:55am UTC](https://community.mp3tag.de/t/replace-some-chars-to/5057/4 "2007-06-24T07:55:38Z")

</div>

Your initial question was about valid filenames. ![:huh:](https://community.mp3tag.de/uploads/default/original/1X/f15ee73c0fd9ec3b0db7481f0558638f8ee224ce.gif ":huh:")

You have to change this characters /?\*"\<\>|: to something else. Otherwise, you can't save it to the filename.

What you can do, to replace single chars in all tagfields, is executing an action like this:

_Aktionstyp:_ **Ersetzen**  
_Feld:_ **\_ALL**  
_Original:_ **?**  
_Ersetzen durch:_ \<-- Enter a !

This will replace the character ? in ALL tagfields with a   
(If you wanna rename the ? only in TITLE, replace \_ALL with TITLE.  
If you wanna rename the : with a - just replace the ? and in the fields above)

Then you can rename your mp3 according to the changed tagfields like this:

_Aktionstyp:_ **Tag-Felder formatieren**  
_Feld:_ **\_FILENAME**  
_Formatstring:_ **%album% - %artist% - %title%**  
(or whatever fields you like to use...)

---

<div class="post-metadata">

### Author: ![lingburg](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/b5e925/32.png) [@lingburg](https://community.mp3tag.de/u/lingburg)
#### Post date: [June 29, 2007, 8:57pm UTC](https://community.mp3tag.de/t/replace-some-chars-to/5057/5 "2007-06-29T20:57:16Z")

</div>

I've found a way to do what I want:  
I created a new action group, called tag-filename  
then I add the following:

Format value  
Field: \_FILENAME  
Format String: %TRACK% - $caps2(%TITLE%)

then, in the same action group:

Replace with regular expression  
Field: \_FILENAME  
Regular Expresion: "/" (without quotes)  
Replace matches with: " - " (without quotes)

then add a new Replace with regular expression, modifying the "/" with ":" and the " - " with " -"

this will replace all filenames with format like this "02 - Song Title"

I don't know if there is a simple way to do this, but for now, it fits my needs 🙂

* * *

So there is another question  
I found that $caps2 its the best case conversion method, cause it leaves some upper case senteces like they should be, not capitalizing only the first letter like the "case conversion - mixed case" action does

So then I want some kind of case conversion that is like the $caps2, but I need that the first letters after " (\_-/ " capitalize too, a feature that the case conversion action has, but $caps2 does not.

For example, a title like "Rock in the USA (yeah!)":

with $caps2, it becomes "Rock In The USA (yeah!)"  
and with cave conversion action, "Rock In The Usa (Yeah!)"

When it should be like "Rock In The USA (Yeah!)"

WHAT SHOULD I DO TO SOLVE THIS?  
I have trouble to to the coding =|

help me please!

---

<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:20pm UTC](https://community.mp3tag.de/t/replace-some-chars-to/5057/6 "2026-02-09T12:20:22Z")

</div>


