Scripting, a request and a question

Request: I've read the Mp3tag Help - Scripting Functions and have some limited regex experience. But some of the solutions I see posted demonstrate ability far beyond the Help resources. What regex implementation (perl? sed?) would be most helpful to refer to when trying to build replace, etc., queries? It was great when I saw a nested query/replace along the way in my searches.

Question: I'm trying to remove everything non-alphanumeric from a file name to deal with a certain car's CD player display (and play) limitations. $replace(%artist%,'The ',, ,,-,,.,,';',,\'&',,) didn't quite work out. (I realize that certain replace may not meet syntax canon. It was the last of several stabs and by then I'd decided to place the request for a study guide that started this topic. Thanks for dynamic preview!)
And what's the escape character? (the character, not the concept.)

I've brought it to a "good enough" level, but there's always next time. TIA

It is said to be mainly a

flavour.
$replace is no regular expression but just a simple replace that replaces text constants and not patterns as regular expressions.
You can test almost any scripting function with Convert>Tag-Tag.

it is the backslash \ is the escape character.
You only need it in regular expressions but not in plain replace functions.
So

is probably a little over the top and a plain & would be enough.

1 Like

Thanks for the background, I'll keep trying

So in the middle of a replacement string does ,,,,x,y, replace a comma with nothing and x with y?
Or would that be ,,,,x,y,
(there are commas in the tags I want to use to rename the files, that's what started this) TIA

Sorry, but the literal backslash was not in the posted text.
So in the middle of a replacement string does ,backslash,,,x,y, replace a comma with nothing and x with y?
Or would that be ,,,,x,y,

The forum software is giving me feedback for so many replies, I think this should do it.

To replace a comma with the $replace() function use such a syntax:
$replace(%title%,',',)
the comma is enclosed in apostrophes (which would be the escape character here)

1 Like