Can't use brackets for a $regexpr within an Action script

Hi everyone, I was messing around with the Actions feature and wanted to make a script that ONLY fills ARTISTSORT with the artists' names that start with "The", "A" or "An" (and their Spanish equivalents), but leaving it empty otherwise. I came up with this script:

$if($eql($regexp(%artist%,^(An?|The|El|Las?|Los?|Una?s?|Unos)\s,),%artist%),,$regexp(%artist%,^(An?|The|El|Las?|Los?|Una?s?|Unos)\s,))

Worked like a charm, but then I realized that only works when the articles have an uppercase. So, I decided to fix the regex to be more efficient by matching upper and lowercases and using brackets for words with similar characters (e.g., unos / unas). This was the result:

$if($eql($regexp(%artist%,^([Aa]n?|[Tt]he|[Ee]l|[Ll][ao]s?|[Uu]na?|[Uu]n[oa]s)\s,),%artist%),,$regexp(%artist%,^([Aa]n?|[Tt]he|[Ee]l|[Ll][ao]s?|[Uu]na?|[Uu]n[oa]s)\s,))

And... nothing happened. I double checked everything and apparently the syntax of the script and the regex were ok (I checked it on RegExr.com). Then I started to test it little by little to find out what part was causing problems. I tested it with this script first:

$if($eql($regexp(%artist%,^The\s,),%artist%),,$regexp(%artist%,^The\s,))

Worked again... then I tried with this one:

$if($eql($regexp(%artist%,^[Tt]he\s,),%artist%),,$regexp(%artist%,^[Tt]he\s,))

And what do you know... it stopped working. Apparently, the brackets were causing problems.

So, I gave up and used the first script I mentioned for uppercase words and duplicate it for the lowercase ones. It's a workaround, but it left me wondering if I'm using the brackets wrong. Does the script parse the brackets in a different way? (Checked the documentation with no results on that subject) Am I overlooking something? Am I that stupid? Is a mp3tag bug? Can't figure it out.

Any kind of advice would be appreciated for sure. Thanks in advance.

PS: If there's a more efficient script or Action, let me know too if posible, please.

For the caseINsensitive search in regex:
The $regexp() function can be made case insensitive by using the 4th parameter: 1

For the problem with the brackets: you need to put the single quote around them if you want to use it unparsed:
Characters with Special Functionality

If you use the function $eql you compare two values. Searching for a word like "The" in the content of ARTIST would only return TRUE if this word would be the only content, not part of a longer string.

If you want to check if the word "The" exists in in ARTIST (lets say like in "The Beatles") you can try one of the 3 existing str-functions: