# Replace specific character in tags and filename

**URL:** https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931
**Category:** Support
**Created:** [May 12, 2020, 11:39pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931 "2020-05-12T23:39:41Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![tomy91](https://community.mp3tag.de/user_avatar/community.mp3tag.de/tomy91/32/7640_2.png) [@tomy91](https://community.mp3tag.de/u/tomy91)
#### Post date: [May 12, 2020, 11:39pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/1 "2020-05-12T23:39:41Z")

</div>

Hello dear Mp3tag community,

I purchased old Pioneer CDJ-200 turntables to practice mixing in my bedroom. It supports MP3 CDs, I burned a few and found out that the players stop with an 8304 error when the filename or any of the ID3 tag fields (mostly Artist, Title and Genre) contains "&" symbol. As the latest firmware update doesn't solve this problem and Pioneer won't give a f\*\*k for a 15 years old legacy device, I'll have to adjust and edit the filenames and tags.

I think **regexp** is the thing I want but I'm not familiar with it.

Can someone please write me **a line that replaces "&" with "and" anywhere in the filename or ID3 tag field(s)**?

And one more quick question:  
My tag field INITIALKEY contains values like "1A", "5B", "11A". How to convert them with a "0" in front of those values with a single number before the letter A or B? "01A", "05B", "11A"

I'd appreciate any help. 🙂

---

<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: [May 13, 2020, 4:30am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/2 "2020-05-13T04:30:29Z")

</div>

> [@tomy91](#):
>
> that replaces "&" with "and" anywhere in the filename

Use an action of the type "Format value" for \_FILENAME  
Format string: `$replace(%_filename%,&,and)`  
I would not replace the & in the tags.  
If you create new filenames for that player, enclose the whole pattern that you use for the filename with the $replace() function so that the filename format string may look like this:  
`$replace($num(%track%,2)_%title%,&,and)`

---

<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: [May 13, 2020, 4:35am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/3 "2020-05-13T04:35:20Z")

</div>

> [@tomy91](#):
>
> INITIALKEY contains values like "1A", "5B", "11A". How to convert them with a "0" in front

Use an action of the type "Format value" for INITIALKEY  
Format string: `$regexp(%initialkey%,^(\d.)$,0$1)`

---

<div class="post-metadata">

### Author: ![tomy91](https://community.mp3tag.de/user_avatar/community.mp3tag.de/tomy91/32/7640_2.png) [@tomy91](https://community.mp3tag.de/u/tomy91)
#### Post date: [May 13, 2020, 9:08am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/4 "2020-05-13T09:08:12Z")

</div>

Thanks, mate, will give it a try this evening.

> [@ohrenkino](#):
>
> I would not replace the & in the tags.

Can I ask why? I have to do it to avoid error on my CDJs. I see no problem there because I'm editing the filename and tags not for my original files in library but the copies made only for burning to CD which I delete afterwards.

---

<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: [May 13, 2020, 11:00am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/5 "2020-05-13T11:00:02Z")

</div>

I just fancy to keep the data in the tags as close to the original as possible...  
Filenames have so many restrictions in respect to valid characters that the only criterion that they have to fulfill is: be unique.  
So why should any other tag "suffer" from the restrictions for the filenames?

---

<div class="post-metadata">

### Author: ![tomy91](https://community.mp3tag.de/user_avatar/community.mp3tag.de/tomy91/32/7640_2.png) [@tomy91](https://community.mp3tag.de/u/tomy91)
#### Post date: [May 13, 2020, 11:18am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/6 "2020-05-13T11:18:58Z")

</div>

Unfortunately the error appears even with a good filename (without "&") if there's "&" somewhere in the artist, title, album or genre field. But as I said - no problem cause I'm creating copies to edit, burn and delete afterwards.

---

<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: [May 13, 2020, 11:23am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/7 "2020-05-13T11:23:31Z")

</div>

I think if you substitute %\_filename% with %\_all% then the action should replace all ampersands everywhere.  
If that does not work, use %\_tag% for all the tag data.

---

<div class="post-metadata">

### Author: ![tomy91](https://community.mp3tag.de/user_avatar/community.mp3tag.de/tomy91/32/7640_2.png) [@tomy91](https://community.mp3tag.de/u/tomy91)
#### Post date: [May 13, 2020, 4:28pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/8 "2020-05-13T16:28:04Z")

</div>

Replacing "&" with "and" works excellent.

But

> [@ohrenkino](#):
>
> $regexp(%initialkey%'^(\d.)$,0$1)

this one writes `[SYNTAX ERROR IN FORMATTING `]` in the field. I'm too dumb to debug. ☹

---

<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: [May 13, 2020, 5:19pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/9 "2020-05-13T17:19:55Z")

</div>

> [@ohrenkino](#):
>
> $regexp(%initialkey%'^(\d.)$,0$1)

should read  
`$regexp(%initialkey%,^(\d.)$,0$1)`

---

<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: [May 13, 2020, 5:23pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/10 "2020-05-13T17:23:40Z")

</div>

> [@ohrenkino](#):
>
> with %\_all% ...%\_tag% for

I have to correct this:  
It is only possible to use \_TAG or \_ALL for actions like "Replace" or "Replace with regular expression". Using %\_tag% only shows the tag version.

---

<div class="post-metadata">

### Author: ![tomy91](https://community.mp3tag.de/user_avatar/community.mp3tag.de/tomy91/32/7640_2.png) [@tomy91](https://community.mp3tag.de/u/tomy91)
#### Post date: [May 13, 2020, 9:34pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/11 "2020-05-13T21:34:40Z")

</div>

Thanks for the quick and detailed help @ohrenkino, I got what (I thought) I needed!

In the end I ruined few more CDs to find out that "&" wasn't the actual problem. Pioneer CDJ-200 and possibly other players from the same generation doesn't like MP3 files that have Xing stream embedded. I solved it by downloading [MP3 Diags](http://mp3diags.sourceforge.net/) and removing all Xing streams from the files before writing them to the CD.

---

<div class="post-metadata">

### Author: ![rochlech](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b487fb/32.png) [@rochlech](https://community.mp3tag.de/u/rochlech)
#### Post date: [October 28, 2024, 6:05am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/12 "2024-10-28T06:05:21Z")

</div>

I'm having trouble finding the option to change the "/" characters to "," - can anyone help me do this?

---

<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: [October 28, 2024, 6:08am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/13 "2024-10-28T06:08:48Z")

</div>

> [@rochlech](#):
>
> I'm having trouble

What have you done so far?  
Are really treating `/` and not `\\`?  
For the latter, see

> [@Replacing Double-back-slash With Semi-colon-Space](https://community.mp3tag.de/t/replacing-double-back-slash-with-semi-colon-space/17673):
>
> Sorry if this is explained elsewhere. I could not find it. Tags like Composer and Style have up to several values (e.g. Michael Preston Barr\\Dion McGregor or World Fusion\\Latin Jazz\\Afro-Cuban\\Afro-Cuban Jazz\\Cuban Traditions) MP3tag only displays the first value in the list and I do not see the rest of the values. I wish to convert from \\ to ; (semi-colon followed by a space) as a list separator. MP3tag displays all the values when saved like Michael Preston Barr; Dion McGregor or …

---

<div class="post-metadata">

### Author: ![rochlech](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b487fb/32.png) [@rochlech](https://community.mp3tag.de/u/rochlech)
#### Post date: [October 28, 2024, 6:19am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/14 "2024-10-28T06:19:09Z")

</div>

Thanks for the answer but I still can't locate the problem - I only use program to mass rename files 🙂  
It looks like this.

David Guetta/Alesso/Madison Love  
I want to change to:  
David Guetta, Alesso, Madison Love

---

<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: [October 28, 2024, 6:38am UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/15 "2024-10-28T06:38:31Z")

</div>

Which function do you use?  
Could you please supply a screenshot of the function that you do not get to work?

In the Converter, use `$replace(%artist%,/,', ')` to modify the output from the field ARTIST

---

<div class="post-metadata">

### Author: ![ItHurtsWhenTCPIP](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/i/e36b37/32.png) [@ItHurtsWhenTCPIP](https://community.mp3tag.de/u/ItHurtsWhenTCPIP)
#### Post date: [October 28, 2024, 2:00pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/16 "2024-10-28T14:00:05Z")

</div>

ohrenkino's solution works perfectly - if what you want is the file name to have commas and the tag data to retain the slashes.

If you want the tag and the filename to both display commas (not slashes) you will need to create a couple of actions for use before doing the file name Converter function:

Action: Replace  
Field: ARTIST  
Original: /  
Replace With: ,

Action: Merge duplicate fields  
Field: ARTIST  
Separator: ,

Which action works depends on if the data in ARTIST is populated as:

- one field, names have a slash between them
- multiple fields, the slash character is the separator

Once the data is formatted with commas in the tag, then the Convert function will work with the simple use of %artist%

---

<div class="post-metadata">

### Author: ![rochlech](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b487fb/32.png) [@rochlech](https://community.mp3tag.de/u/rochlech)
#### Post date: [October 28, 2024, 8:31pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/17 "2024-10-28T20:31:31Z")

</div>

Yes, of course - my menu is in Polish but don't worry, I can change it to English, it's about mass change - setting a template for such names so that they are changed without special characters that Windows cannot use, in this case it is "/"

 ![Bez tytułu](https://community.mp3tag.de/uploads/default/original/3X/8/e/8eaad9b71fda13f19a8357756fac86473ce289f0.png)

---

<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: [October 28, 2024, 8:35pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/18 "2024-10-28T20:35:53Z")

</div>

Now it would be nice to see the function with which you try to rename the files.  
Or perhaps to shorten that a little bit:  
Have you tried to use

> [@ohrenkino](#):
>
> `$replace(%artist%,/,', ')`

instead of the the plain %artist%?

---

<div class="post-metadata">

### Author: ![rochlech](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/b487fb/32.png) [@rochlech](https://community.mp3tag.de/u/rochlech)
#### Post date: [October 28, 2024, 10:05pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/19 "2024-10-28T22:05:43Z")

</div>

Finally finally!!!

How can I repay You master?

---

<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: [November 27, 2024, 10:05pm UTC](https://community.mp3tag.de/t/replace-specific-character-in-tags-and-filename/48931/20 "2024-11-27T22:05:45Z")

</div>

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