[X] More than 9 Regular Expressions together

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. :wink:

Thanks in advance and keep up the good work. :slight_smile:

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

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?

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

DD.20140626.0924.CEST

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

Many thanks to you DetlevD! :slight_smile:
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. . . :frowning:
I was focused on solving the problem, and I did it. Now I'm using only 1 or 2 reg ex. What a difference! :slight_smile:

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

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. :wink:

But thanks for pointing that out.

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