# \[X\] More than 9 Regular Expressions together

**URL:** https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849
**Category:** No Bugs
**Created:** [June 25, 2014, 4:30pm UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849 "2014-06-25T16:30:22Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Nature](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/a587f6/32.png) [@Nature](https://community.mp3tag.de/u/Nature)
#### Post date: [June 25, 2014, 4:30pm UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/1 "2014-06-25T16:30:22Z")

</div>

I just came across a weird situation.

I am trying to make a similar replacement for music file types. Basically I want all of them to _always_ be lowercase, after using mixed case.

The RegEx I'm using is this:  
FIND...: (.AAC)$|(.AIFF)$|(.APE)$|(.CDA)$|(.FLAC)$|(.M4A)$|  
(.MP3)$|(.OGG)$|(.WAV)$|(.WMA)$  
REPLACE: \L\1\L\2\L\3\L\4\L\5\L\6\L\7\L\8\L\9\L\10

However, this replaces ".flac" by ".flac0" (I'm using Mp3Tag v2.60 - the latest now)

If I remove one of the expressions, making them only 9, it works as intented.

So is this a bug or just a lack of support by MP3Tag for more than 9 replacements on the same Regular Expression?

Suggestion: Maybe it's just a matter of padding the number to two digits (e.g. 09, instead of 9), and always read two digits instead of just one. 😉

Thanks in advance and keep up the good work. 🙂

---

<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: [June 25, 2014, 4:41pm UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/2 "2014-06-25T16:41:57Z")

</div>

> [@Nature](#):
>
> I just came across a weird situation. ...

This works ... you have to adapt it to your needs.  
Note: The proposals change filename extension to upper case.  
You need to change it to lower case.

Action: Format value  
Field: \_FILENAME  
Fomatstring:

**$regexp(%\_filename\_ext%,'\.(AAC|AIFF|APE|CDA|FLAC|M4A|MP3|OGG|WAV|WMA)$','.\U$1',1)**

... or ...

**$regexp(%\_filename\_ext%,'\.(.+)$','.\U$1',1)**

... or ...

**$regexp(%\_filename\_ext%,'(\..+)$','\U$1',1)**

... or ...

**$regexp(%\_filename\_ext%,'(\.[^\.]+)$','\U$1',1)**

DD.20140625.2054.CEST

---

<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: [June 26, 2014, 4:28am UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/3 "2014-06-26T04:28:04Z")

</div>

> [@DetlevD](#):
>
> Change filename extension to upper case.  
> ...

Didn't the OP intend to convert the case to lower ...?  
What I am still wondering: why do you need that lenghty list of extensions, if you actually want to convert teh case of all extensions to lower?  
Isn't there a pattern of (,_)(.._)$ enough?

---

<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: [June 26, 2014, 5:23am UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/4 "2014-06-26T05:23:58Z")

</div>

> [@ohrenkino](#):
>
> Didn't the OP intend to convert the case to lower ...?

Therefore I wrote, that he has to adapt it to his needs. 😉

DD.20140626.0924.CEST

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [June 26, 2014, 4:28pm UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/5 "2014-06-26T16:28:31Z")

</div>

Back references via \n are limited to n in the range 1-9. This limitation is exposed by the regular expression engine.

---

<div class="post-metadata">

### Author: ![Nature](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/a587f6/32.png) [@Nature](https://community.mp3tag.de/u/Nature)
#### Post date: [June 27, 2014, 3:11pm UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/6 "2014-06-27T15:11:49Z")

</div>

> [@DetlevD](#):
>
> This works ... you have to adapt it to your needs.
> 
> Action: Format value  
> Field: \_FILENAME  
> Fomatstring:  
> [size=1][font="Courier New"][b]$regexp(%\_filename\_ext%,'.(AAC|AIFF|APE|CDA|FLAC|M4A|MP3|OGG|WAV|WMA)$

Many thanks to you DetlevD! 🙂  
This line with the pipes makes all the difference. I didn't know I could join several words to be affected by the same regex. I only thought it would allow to join several different reg expressions, not just words. . . But now I know, I discovered this on another google search yesterday. eheheh What a pity I didn't come here earlier. . . ☹  
I was focused on solving the problem, and I did it. Now I'm using only 1 or 2 reg ex. What a difference! 🙂

I also liked to thank Florian for poiting out the limitation of 9 expressions. I didn't know about it.

---

<div class="post-metadata">

### Author: ![Nature](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/n/a587f6/32.png) [@Nature](https://community.mp3tag.de/u/Nature)
#### Post date: [June 27, 2014, 3:16pm UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/7 "2014-06-27T15:16:14Z")

</div>

> [@ohrenkino](#):
>
> Didn't the OP intend to convert the case to lower ...?  
> What I am still wondering: why do you need that lenghty list of extensions, if you actually want to convert teh case of all extensions to lower?  
> Isn't there a pattern of (,_)(.._)$ enough?

Somehow a similar pattern wasn't working in my expression.  
In fact, I even experimented it in two text editors I trust (Notepad++ and EmEditor), and the expression worked, but on Mp3Tag it would always UPPERcase the first letter of the file extension, so I quit using the \_FILENAME. And then I also realized that the \_FILENAME would have to have a specific regex because it may have other text besides the title, something that initially I didn't think about.  
So I ended up quitting to change the \_FILENAME. I'll leave that to the user and there's an advantage to that: the user may check the difference before and after the change, by comparing the TITLE and the FILENAME. 😉

But thanks for pointing that out.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 28, 2018, 2:34pm UTC](https://community.mp3tag.de/t/x-more-than-9-regular-expressions-together/15849/8 "2018-12-28T14:34:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
