Regex handling: Mac vs. Win

I stumbled into interesting problem, where Regex used in Windows version does not work at all in Mac version.

Regex itself:

%ARTIST%$regexp(%TITLE%,'^(.+?)\s+[[({<]?\s*(?:featuring|feat\.?|ft\.?)\s*([^])}>]+)[])}>]?(.*)$',' feat. $2$3+++$1',1)

When applied to TITLE, via Convert -> Tag - Tag:
In Windows version, it works fine and produces expected output:
"Aphex Twin feat. XYZ+++Ageispolis"

On Mac version, it produces:
Aphex TwinInvalid regular expression: ^(.+?)\s+[[({<]?\s*(?:featuring|feat\.?|ft\.?)\s*([^])}>]+)[])}>]?(.*)$

Tag used for testing looks like this:
TITLE: Ageispolis (feat. XYZ)
ARTIST: Aphex Twin

For me it does look like, Mac version handles regex differently, but I (at least currently) don't quite understand how or why.

Ok apparently, it dislikes s+ in that regex.
Not sure though, why and how to fix this, as replacing + with {1,} does not seem to work either.

OK, looks like I managed to fix it, but still unsure why it does not work on MacOS.
What I did, I simply removed highlighted square bracket (first one after \s+).

%ARTIST%$regexp(%TITLE%,'^(.+?)\s+[[({<]?\s*(?:featuring|feat.?|ft.?)\s*([^])}>]+)[])}>]?(.*)$',' feat. $2$3+++$1',1)

Now it works on both, Windows and MacOS.
Interestingly, Windows version does not even seem to care, even if I add more square brackets and completely break "regex rules" :rofl:

Another interesting thing seems to be, that on Mac \l matches escaped letter "l", instead of it acting as Lowercase shorthand

At the end of the day, it is quite confusing and maybe someone else can shed better light into it. :roll_eyes:

AFAIK the documentation on MP3tag for Mac states that for "Replace with regular expressions" a different syntax is used:


Thank you @ohrenkino, I already thought that I am loosing my mind :smiley:

I’m not sure if this is your entire statement, but it looks like both the round and square brackets don’t have matching open/close states. Looks like you identified one square bracket condition, but I still think you have an extra closing round bracket as well.

I believe you are right, but fun fact is that on Windows version it worked just fine in that state.
I started to get errors after I migrated all my actions over to Mac version and I am currently in progress of rewriting and checking each one of them, as I have lots of regex related issues on Mac version at the moment.
All of those worked fine on Windows version.

I’m sure there are many more “fun” differences you will find. This is par for the course between operating systems. But I think if you start by correcting the context of your statements they will work more effectively across all. There may be some conditions in Windows that this may not produce correct results.