# 'Filename of playlist' option and $replace issue

**URL:** <https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989>\
**Category:** Support\
**Created:** [May 16, 2023, 3:56am UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989 "2023-05-16T03:56:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bd0426](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bd0426](https://community.mp3tag.de/u/bd0426)\
**Post date:** [May 16, 2023, 3:56am UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/1 "2023-05-16T03:56:30Z")

</div>

MP3tag v3.20.

I am trying to use the following to get MP3tag to remove a character when creating a playlist.

`%albumartist% - %year% - $replace(%album%,:,'-').m3u`

However I am given the following message with the : highlighted...

Playlist - Filename:  
Following characters are not allowed in file names:  
`\\/:*?"<>|`  
Do you want it corrected automatically?

If I replace the : with an \_, the string is accepted fine, and works as intended. This leads me to believe that if it would accept the string, the : would be replaced with a - as I intended. But, it won't allow me to put the : in the string.

Any hints at a work-around?

---

<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 16, 2023, 5:30am UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/2 "2023-05-16T05:30:43Z")

</div>

> [@bd0426](#):
>
> Following characters are not allowed in file names:  
> `\\/:*?"<>|`

Are you sure that the incriminating character is the colon and that it appears in ALBUM?  
To write filenames without problematic characters, see $validate()

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

... and for a simpler expression, you could leave out the apostrophes in the $replace() call.

---

<div class="post-metadata">

**Author:** ![bd0426](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bd0426](https://community.mp3tag.de/u/bd0426)\
**Post date:** [May 16, 2023, 3:13pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/3 "2023-05-16T15:13:13Z")

</div>

Thank you for the reply.

Yes, unfortunately I have many album titles with colons in them (sad face).

It's quick and easy to reproduce, thankfully. I was hoping someone would recognize an error and let me know what I'm doing wrong.

I was thinking maybe I needed additional characters to delimit or avoid parsing or something similar. But, so far, still no-go.

---

<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 16, 2023, 3:15pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/4 "2023-05-16T15:15:57Z")

</div>

Which function do you use to create that filename?  
Have you tried $validate()?

---

<div class="post-metadata">

**Author:** ![bd0426](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bd0426](https://community.mp3tag.de/u/bd0426)\
**Post date:** [May 16, 2023, 3:41pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/5 "2023-05-16T15:41:48Z")

</div>

Indeed, $validate() yields the same results.

Perhaps pics explain it better...

![aftermath](https://community.mp3tag.de/uploads/default/original/2X/4/4e6579cd6861dbc6c9a9a534bfe0089843fb6227.jpeg)  
 ![main](https://community.mp3tag.de/uploads/default/original/2X/1/15baccb7c4fb6b65369d30e5fb4ed93691414d6a.jpeg)  
 ![message](https://community.mp3tag.de/uploads/default/original/2X/1/12c2a968235ca4031ee5c9f546bd82e7e9db0828.jpeg)

Replace the : with an \_ and all is good and it works. But, I need it to eliminate :s not \_s.

---

<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 16, 2023, 3:46pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/6 "2023-05-16T15:46:36Z")

</div>

Oh, I see - this is just a stray error message.  
If you use  
`%albumartist% - %year% - $validate(%album%,-).m3u`  
it should work the way you want it.  
Apparently, the plausibility check for the filename only checks for the colon anywhere in the filename definition and does not detect that the colon is part of a scripting function.  
See, whether the suggestion with $validate() works

---

<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:** [May 16, 2023, 3:47pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/7 "2023-05-16T15:47:48Z")

</div>

> [@ohrenkino](#):
>
> If you use  
> `%albumartist% - %year% - $validate(%album%,-).m3u`  
> it should work the way you want it.

Only if ALBUMARTIST does not contains something like AC/DC or A\*Teens 😉

---

<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 16, 2023, 3:56pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/8 "2023-05-16T15:56:46Z")

</div>

I think that the resulting string would be checked again against the rules.  
But here, the syntax check does not see that the colon is nothing evil but something inside a scripting function. The error message and the offer to rectify the alleged mistake will lead to a disabled replace function.

---

<div class="post-metadata">

**Author:** ![bd0426](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bd0426](https://community.mp3tag.de/u/bd0426)\
**Post date:** [May 16, 2023, 7:00pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/9 "2023-05-16T19:00:33Z")

</div>

Thanks to @ [ohrenkino](https://community.mp3tag.de/u/ohrenkino).

Your solution works for my need(s).

Not sure about @ [LyricsLover](https://community.mp3tag.de/u/LyricsLover)'s comment. I dragged over an AC/DC album to see if it affected it, and it did not. It came out as AC-DC, which is what I want.

Any chance you (LyricsLover) have a good example routine I can try to illustrate what you're trying to say?

---

<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:** [May 16, 2023, 7:03pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/10 "2023-05-16T19:03:43Z")

</div>

> [@bd0426](#):
>
> I dragged over an AC/DC album to see if it affected it, and it did not. It came out as AC-DC, which is what I want.

Then everything is fine. If AC-DC is the spelling you want, just ignore my comment.

---

<div class="post-metadata">

**Author:** ![bd0426](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@bd0426](https://community.mp3tag.de/u/bd0426)\
**Post date:** [May 17, 2023, 1:59pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/11 "2023-05-17T13:59:27Z")

</div>

Thinking about what [LyricsLover](https://community.mp3tag.de/u/LyricsLover) said, I can see scenarios where I'd like a different character to replace specific invalid characters. It doesn't seem $validate will do that. Working with it a bit has shown $validate is a bit of an all-or-nothing approach in practice.

It seems if it were possible to over-ride the plausibility check, $replace would work the way I originally intended.

Perhaps the devs would consider a soft warning that could be implemented rather than a forced cancel or auto-correct which removes the 'invalid' character?

---

<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:** [June 16, 2023, 2:00pm UTC](https://community.mp3tag.de/t/filename-of-playlist-option-and-replace-issue/60989/12 "2023-06-16T14:00:04Z")

</div>

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