Remove/Trim X Characters from %tag%?

Tags: #<Tag:0x00007f75689beaf8>

I’m trying to come up with a foolproof way to get rid of X amount of characters at the beginning of a particular tag.

Tracks that have the Track Number in the Title… So I need to remove the first 4 characters. 'xx. ’

All the script commands dealing with characters seem to be for if present, or are related to specific characters, not wildcards.

`$triml(%tag%,4) (Trim Tag from the Left, 4 Characters)

This case looks like it would make sense to use $rreplace(text,pattern,replace) … or maybe the data in MB should be corrected instead?

I see two options for your particular problem given the existing functions.

Using regular expressions to replace the digits from the start. This has the advantage that it really only does any replacement if the start is really a number:

$rreplace(%tag%,^\\d+\\.\\s+,)

Actually cut of the first 4 characters:

$right(%tag%,$sub($len(%tag%),4))

As a new function something like a substr function probably would make sense.

2 Likes

It’s not data in MB that’s the problem. It’s Not wanting it to go in like that, and having to change so many at one time.

Okay. Seriously. I didn’t realize those commands could be used in a literal sense!

Can you give a specific example of where you’re getting track numbers in a title tag? Or do you mean the filename? @kellnerd is right that it sounds like you’re getting bad data, so I’m trying to understand where it’s coming from.

It’s purely bad data from file preparation, which of course, ends up in the filename generated too.

Changing 3,000 of them? LOL. No thanks.

Now it’s much better:

1 Like

Glad it worked :slight_smile: Forgot to mention that everything I wrote was untested and thumbed in on my phone :wink:

3 Likes