# Regular Expressions Baffle Me

**URL:** <https://community.mp3tag.de/t/regular-expressions-baffle-me/19329>\
**Category:** Support\
**Created:** [September 7, 2017, 4:25pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329 "2017-09-07T16:25:36Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tinctoris](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tinctoris](https://community.mp3tag.de/u/Tinctoris)\
**Post date:** [September 7, 2017, 4:25pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/1 "2017-09-07T16:25:36Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [September 7, 2017, 4:34pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/2 "2017-09-07T16:34:37Z")

</div>

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

so that equals  
(BC\s+A\d+)

---

<div class="post-metadata">

**Author:** ![Tinctoris](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tinctoris](https://community.mp3tag.de/u/Tinctoris)\
**Post date:** [September 7, 2017, 6:01pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/3 "2017-09-07T18:01:45Z")

</div>

> [@stevehero](#):
>
> ( matches (  
> BC matches BC  
> \s+ matches any number of spaces  
> A matches A  
> \d+ matches any number of digits  
> ) matches )
> 
> so that equals  
> (BC\s+A\d+)

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!!!

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [September 7, 2017, 6:31pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/4 "2017-09-07T18:31:44Z")

</div>

> [@Tinctoris](#):
>
> 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**

```
(?i)\(bc\s+a\d+\)

```

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

then  
\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](https://www.google.ie/search?num=50&q=regex+tester&spell=1&sa=X&ved=0ahUKEwiuj8f59JPWAhWDOsAKHRcBA80QvwUIJCgA&biw=1954&bih=1080)**

And to learn: [http://www.regular-expressions.info/](http://www.regular-expressions.info/)

---

<div class="post-metadata">

**Author:** ![Tinctoris](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tinctoris](https://community.mp3tag.de/u/Tinctoris)\
**Post date:** [September 8, 2017, 9:58pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/5 "2017-09-08T21:58:31Z")

</div>

> [@stevehero](#):
>
> 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**
> 
> ```
> (?i)\(bc\s+a\d+\)
> 
> ```
> 
> 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
> 
> then  
> \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](https://www.google.ie/search?num=50&q=regex+tester&spell=1&sa=X&ved=0ahUKEwiuj8f59JPWAhWDOsAKHRcBA80QvwUIJCgA&biw=1954&bih=1080)**
> 
> And to learn: [http://www.regular-expressions.info/](http://www.regular-expressions.info/)

Thanks again! I will do my best. 😳

---

<div class="post-metadata">

**Author:** ![Tinctoris](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tinctoris](https://community.mp3tag.de/u/Tinctoris)\
**Post date:** [September 9, 2017, 6:18pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/6 "2017-09-09T18:18:02Z")

</div>

> [@Tinctoris](#):
>
> Thanks again! I will do my best. 😳

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.

Thanks!

![](https://community.mp3tag.de/uploads/default/original/2X/f/f2149ba76881602c4810b84acbdcb050a830dc0c.PNG)

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [September 9, 2017, 7:07pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/7 "2017-09-09T19:07:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [September 9, 2017, 11:27pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/8 "2017-09-09T23:27:38Z")

</div>

> [@Tinctoris](#):
>
> ... how to remove these characters **(BC A24)** from the TITLE field. ...

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.

DD.20170910.0327.CEST

---

<div class="post-metadata">

**Author:** ![Tinctoris](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/d9b06d/32.png) [@Tinctoris](https://community.mp3tag.de/u/Tinctoris)\
**Post date:** [September 13, 2017, 8:35pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/9 "2017-09-13T20:35:10Z")

</div>

> [@DetlevD](#):
>
> 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.
> 
> DD.20170910.0327.CEST

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!

---

<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:** [September 14, 2017, 3:26am UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/10 "2017-09-14T03:26:05Z")

</div>

> [@Tinctoris](#):
>
> ...too much information to display in the player. ...

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.

---

<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:** [February 9, 2026, 12:27pm UTC](https://community.mp3tag.de/t/regular-expressions-baffle-me/19329/11 "2026-02-09T12:27:00Z")

</div>


