# who can help with a special regular expression?

**URL:** https://community.mp3tag.de/t/who-can-help-with-a-special-regular-expression/10827
**Category:** Support
**Created:** [September 18, 2010, 6:51pm UTC](https://community.mp3tag.de/t/who-can-help-with-a-special-regular-expression/10827 "2010-09-18T18:51:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![globetrotters1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@globetrotters1](https://community.mp3tag.de/u/globetrotters1)
#### Post date: [September 18, 2010, 6:51pm UTC](https://community.mp3tag.de/t/who-can-help-with-a-special-regular-expression/10827/1 "2010-09-18T18:51:40Z")

</div>

Hi,

I often have the problem that in a track file name like

**Flute Sonata B-Dur**

an "in" is missing, so it will read

**Flute Sonata in B-Dur**

Only problem is that it can be A-Dur through H-Dur and a-moll through h-moll and it should exclude the strings which already have an "in " in front of the Dur/moll - furthermore there are the As, Des, Fis, Cis etc values in front of the -Dur and -moll possible

Who can help?

thanks

---

<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 19, 2010, 5:02am UTC](https://community.mp3tag.de/t/who-can-help-with-a-special-regular-expression/10827/2 "2010-09-19T05:02:18Z")

</div>

> [@globetrotters1](#):
>
> ... I often have the problem that in a track file name like  
> **Flute Sonata B-Dur**  
> an "in" is missing, so it will read  
> **Flute Sonata in B-Dur**...

1. 

You may deepen your knowledge on the key signatures.  
[http://en.wikipedia.org/wiki/Circle\_of\_fifths](http://en.wikipedia.org/wiki/Circle_of_fifths)  
[http://de.wikipedia.org/wiki/Quintenzirkel](http://de.wikipedia.org/wiki/Quintenzirkel)

1. 

I understand your request this way.

You want to manipulate a given filename:  
"Flute Sonata B-Dur"

You want to insert the word "in" before a word which is a key signature to get the filename:  
"Flute Sonata in B-Dur"

You want not to change filenames which are already have the word "in" before a key signature.

1. 

Use Mp3tag list view. Press [F3] to open the Filter dialog.  
There might exist several expressions to filter your file base in order to see only those files, which do not have the word "in" before a key signature.

First see what files have already the word "in" before a key signature:  
**%\_FILENAME% MATCHES "^(.+) in ((?:.+?)-(?:moll|Dur))(.\*)$"**

To see all files which do not have the word "in" before a key signature:  
**NOT %\_FILENAME% MATCHES "^(.+) in ((?:.+?)-(?:moll|Dur))(.\*)$"**

There might be other files shown which are not of interest, so you have to do some refinement on the filter expression.  
Examples:  
**(("%\_FILENAME%" HAS "-moll") OR ("%\_FILENAME%" HAS "-Dur")) AND NOT ("%\_FILENAME%" HAS " in ")**

**NOT %\_FILENAME% MATCHES "^(.+) in ((?:.+?)-(?:moll|Dur))(.\*)$" AND (("%\_FILENAME%" HAS "-moll") OR ("%\_FILENAME%" HAS "-Dur"))**

1. 

Set the filter to see only files, which do not have the word "in" before a key signature.

Use an action **"Replace with Regular Expression"**  
Field: **%\_FILENAME%**  
Regular expression: **^(.+)\s((?:.+?)-(?:moll|Dur))(.\*)$**  
Replace matches with: **$1 in $2$3**  
Case-sensitive comparison: **yes**

Alternative:  
Action **"Format value"**  
Field: **%\_FILENAME%**  
Formatstring: **$regexp(%\_FILENAME%,'(?-i)^(.+)\s((?:.+?)-(?:moll|Dur))(.\*)$','$1 in $2$3')**

1. 

Ready.

DD.20100919.0900.CEST

---

<div class="post-metadata">

### Author: ![globetrotters1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@globetrotters1](https://community.mp3tag.de/u/globetrotters1)
#### Post date: [September 25, 2010, 11:59am UTC](https://community.mp3tag.de/t/who-can-help-with-a-special-regular-expression/10827/3 "2010-09-25T11:59:36Z")

</div>

DetlevD,

many thanks for your kind help!  
Very much appreciated

And you are right, I didn't know certain details of the key signatures  
Your hint is very valuable for me...  
Every day learning something new!

🙂

---

<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:22pm UTC](https://community.mp3tag.de/t/who-can-help-with-a-special-regular-expression/10827/4 "2026-02-09T12:22:33Z")

</div>


