Validate function ignores backslash


I'd like to ask, is it intended that the $validate function ignores the backslash symbol? All other illegal characters are properly replaced. I ran into this problem recently by trying to convert the tag of the song "40 Years Back\Come" from Röyksopp to filename with the following format string: "$validate([%artist% - ]%title%,_)". I was surprised that the $validate function ignored the backslash and I ended up with a directory "Röyksopp - 40 Years Back" and the song "Come" inside of it (classic windows behavior). I know that I can replace this character by using the $replace function, but I was wondering if the $validate function ignoring the backslash is intended?

Thanks a lot for the feedback, much appreciated!

Yes, it is intentional. Using the backslash in a filename allows you to create new folder structures (what you probably just found out unintentionally).

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

Note: $validate allows the backslash as the delimiter within a path string.
Note: $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.

Usage: $validate(,)
Following invalid characters will be replaced with ReplaceChar:
034 "
042 *
047 /
058 :
060 <
062 >
063 ?
124 |

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


Thank you for the answers. So if I wanted to continue to use validate and also replace any backslashes, how would the string need to look like? I came up with this, but I am not sure if it's correct.

$validate($replace([%artist%] - %title%,,),)

If you don't want to use the function $validate, then you may apply the function $replace this way ...

$replace([%ARTIST%' - ']%TITLE%,'\','_','"','_','*','_','/','_',':','_','<','_','>','_','?','_','|','_')


I don't know why do you assume that I don't want to use the $validate function anymore when I said that I do want to continue using it, but in addition I want to replace the backslash with underscore. Do you think the string in my previous post is correct? Thanks!

Because you gave different formatstring examples in your posts #1 and #4, ...
and because you have applied the special functionality of the "[...] square bracket function", ...
I cannot judge about the correctness of your formatstrings.

You can check a formatstring for your own within the converter "Tag - Tag", ...
because the converter dialog offers a preview of the result of a given formatstring.


Of course I gave a different string in post #4, I just included the replacing of backslash into it. And since I don't know script formatting very well, I was asking you because I though you know script formatting well (I assumed this from the 6k forum posts you have).

Yes, because some of my files don't have an artist (yet) so I simply want them to be named just "Title".

I am aware that there is a preview, but I wasn't sure if this will work with all of my current (and future) files without giving me any errors at some point. Anyway, thanks for all of your feedback, I will simply use the string and hope it will work correctly every time.