Regular Expressions Baffle Me

I am trying to figure out how to remove these characters (BC A24) from the TITLE field. The numbers are different for each disc, however, so basically I want to remove (BC A##)

I can't figure out what regular expressions to use. Please help!

( matches (
BC matches BC
\s+ matches any number of spaces
A matches A
\d+ matches any number of digits
) matches )

so that equals

BRILLIANT. It worked, of course. I don't know why I can't wrap my mind around this, especially since I am pretty good with HTML. Maybe I just need to practice. THANK YOU!!!

It's really easy. (for the basics)

You can use literals such as A, B, C or a,b,c which will match those letters dependant on casing.

But you can switch this behaviour for reg exp by placing (?i) before a,b,c so it matches any UPPERCASE letters too.

So to translate that, my 1st expression could be changed to: (?i) added to start


This would match:
(BC A24)
(Bc a24)
(bc a24)

Then you have characters like ( which need to be escaped for reg exp resulting in ( being used.

Whitespace regexp syntax is \s
digit is \d
letter is \w

\S is not a whitespace
\D is not a digit
\W is not a letter

If you're stuck google the char you want to match using reg exp you'll find the solution.

There's several regexp testers to try out your expressions on like these

And to learn:

Thanks again! I will do my best. :flushed:

Doing pretty well now, actually. But now I have a rather complex replacement that may not even be possible. I'm working with the complete Bach Cantatas, which I have ripped as FLAC from a 56-box set that I own. As you can see from the attached, some of the cantatas have ripped with each movement being numbered (BWV 150), while the majority have not, as seen in the three cantatas above it. Is there anyway to auto-number movement numbers after the BWV number and semicolon? This would require the numbering restarting for each cantata.

Since each disc holds multiple cantatas, the movement numbers do not equal the disc track numbers, except in the case of the first cantata on each disc. Further, the cantatas do not all have the same number of movements.

If this cannot be done in a single batch or even per disc, with the numbering restarting at 1. for each cantata, could it be done one cantata at a time? Otherwise, I will renumber each movement manually, which is quite time-consuming with 200 or so cantatas.


Best thing you could do and quickest is if you've got them files in each of their individual folders relative to their album then use the autonumbering wizard to number the tracks by directory.

Then use that number to fill in the value you want after the semi-colon.

Use format action on whatever tag you're using with, in this example it's TITLE

Format: TITLE
With: $replace(%title%,;,; %track%.)

I think that's what you're after?

Edit. Looking at your screen shot again it looks like you have the track filled in so just go to the replace bit.

You should consider that such a string value like '(BC A24)' is a special value, because it is the registering scheme for the "Bach Cantatas".
You should not loose such valuable data. Move those values into a different tagfield of your choice.


Yes, while I agree it is important from a musicological standpoint (I actually hold a Ph.D. in musicology), I don't want it in my music library as it is just too much information to display in the player. I'm happy with just the BWV number. But thanks!

This may well be.
Yet, if you move the information to a user-defined field (or a standard one that you do not use) it will not be lost and you can recycle it if you change your mind.

And as most players do not display user-defined fields, you have the best of both worlds: no display but the information is still there.

It is very tedious to restore deleted information.