ARTISTSORT: The Beatles, Billy Preston

Hello guys.
My goal this time is to create an action set that will turn [The Beatles, Billy Preston] into [Beatles, Billy Preston, The] using regular expression. I have referred the previous post and his method doesn't cover mine. Unfortunately, I'm not yet adept on using the format string method therefore am once again requiring your support.

arrangement:
[1]The [2]Beatles(,) [3]Billy [4]Preston
into:
[2]Beatles(,) [3]Billy [4]Preston(,) [2]The

Link: Share your custom Actions

To be honest: do you really have to move the "The" to the end? If the new string is used for sorting, then I bet it would be enough to simply delete the "The".
In respect to the regular expression:
Search string: The (.*)
Replace string: $1, The

1 Like

Huhuhu don't be angry at me sensei, I have no idea how to delete that. But you have a really solid point.

I'll re-do my action set.

I am not angry or so , no, really not.
I just sometimes wonder why things should be so overcomplicated.

To get rid of the leading "The", you could try:
An Action of the type "Replace with regular expression" for ARTISTSORT
Search string: ^The_
(The _ = space)
Replace string:
(leave empty)

1 Like

Sensei, my solution goes:
$1 = The
$2 = Beatles(,)
$3 = Billy
$4 = Preston

Merge duplicate with ", "
Format ARTISTSORT from %artist%
Regular expression: ^(.+)\s(.+)\s(.+)\s(.+)$
Replace matches: $2 $3 $4
Split ARTIST with ","

it yields Artist Sort: Beatles, Billy Preston

Is this efficient in your opinion?

Have you tried my suggestions?
They look shorter.

1 Like

No I haven't. In my understanding, your solution only applies if we're dealing with The Beatles only, or something similar. Does it work with a second artist in the field together? Excuse me if I'm slow in following I'm learning this bit by bit and just prodding and trying things.

Well, if you have not tried them why am I bothering?

I don't read anything about the Beatles in my suggestion just the pattern of a string which starts with "The" and that "The" is moved to the end or gets deleted.
That works for every string with that pattern, regardless how many words, commas, hyphens, you name it, are following the "The".

AHHHH gotcha. Thanks for the explanation. Many thanks for incessantly assisting me.

God bless, stay safe.

It's me again sensei, I tried your solution. It didn't work. Is there anything that I'm doing wrong?
Screenshot 2020-12-24 103013

You wrote an underscore instead of a space.

I changed it. Still the same. Any clue?

It works here.
Is it really the field ARTISTSORT you are treating or is it the field ARTIST?
What is the present content of ARTISTSORT?

If you have only filled ARTIST and want to move the content from ARTIST without "The" to the field ARTISTSORT take the converter Tag->Tag:
Field: ARTISTSORT
Formatstring: $regexp(%artist%,^The ,)

1 Like

the field I'm treating is the ARTISTSORT, and I have already format value from ARTIST.

Then please check your search terms.
The expression is correct and works for cases with a leading "The" plus a space character following it.

1 Like

Solved. Thank you @poster and sensei @ohrenkino!

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