# Character replacement for Tag—Filename?

**URL:** https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645
**Category:** Support
**Created:** [July 23, 2023, 2:49am UTC](https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645 "2023-07-23T02:49:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![0LD3\_DUDE](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/0/3e96dc/32.png) [@0LD3\_DUDE](https://community.mp3tag.de/u/0LD3_DUDE)
#### Post date: [July 23, 2023, 2:49am UTC](https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645/1 "2023-07-23T02:49:27Z")

</div>

EAC can do this: Replace unsupported characters for filename creation. Surely, this is already part of MP3Tag, and I just can't find it?

I have any number of song titles with characters that cannot be used in a file name (colon, semicolon, double quotes, question marks, and more. In my case, EAC converts these to a circumflex (^) when creating file names from metadata found online. I subsequently use those file names are used to populate tags in MP3Tag. The tags are then used to simplify long file names for my music library (I use %artist% - %title%).

For a variety of reasons, I often find myself having to manually reinsert that circumflex into file names, as it gets lost when special characters are present in the %title% field of my tags. This is a hassle.

**MP3Tag can selectively replace unsupported characters when creating file names from tags, can it not?**

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [July 23, 2023, 4:45am UTC](https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645/2 "2023-07-23T04:45:02Z")

</div>

Have a look at the scripting functions and especially $validate() and $replace().

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#string-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

$validate() can be used to replace any invalid character in filename-building with 1 defined character.  
$replace can be used to replace any invalid invidual character with defined characters.

i.e  
`$validate(%artist% - %title%,^)`  
`$replace(%artist% - %title%,:, -, *,+ ..... pairs of unvalid characters and characters that should replace them seperated by a comma)`

---

<div class="post-metadata">

### Author: ![0LD3\_DUDE](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/0/3e96dc/32.png) [@0LD3\_DUDE](https://community.mp3tag.de/u/0LD3_DUDE)
#### Post date: [July 23, 2023, 11:22am UTC](https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645/3 "2023-07-23T11:22:06Z")

</div>

Seems the sort of thing that should be coded into the UI.

I appreciate the link, but it just provides a list of commands. I've no idea how to implement scripting for MP3Tag.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [July 23, 2023, 11:26am UTC](https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645/4 "2023-07-23T11:26:38Z")

</div>

Even without these special functions you will get only valid filenames.  
These functions are available for those who require a special treatment.  
And if you create a corresponding action then you have it in the UI.

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [July 23, 2023, 12:11pm UTC](https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645/5 "2023-07-23T12:11:21Z")

</div>

Please don't shy away from the word "scripting".

You are already using "scripting" because you are obviously working with the converter and the format string `%artist% - %title%`.  
Then why should it be difficult to take my 1st example and instead of your format string  
`%artist% - %title%`  
simply write  
`$validate(%artist% - %title%,^)`  
and you already have the result that your software EAC has also written so far.

With the variant $replace() you are able (if you want) to act a little more individually and not replace every invalid character with the same character but use an individual character for replacement in each case.

---

<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: [August 22, 2023, 12:12pm UTC](https://community.mp3tag.de/t/character-replacement-for-tag-filename/61645/6 "2023-08-22T12:12:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
