Swapping First & Last Name in Title

Change this:
Fantasia Barrino - Got Me Waiting
To this:
Barrino, Fantasia - Got Me Waiting

Use "Replace"

Replace: <Word:1> <Word:2>

Replace with: <Word:2>, <Word:1>

Have "use regular expressions" checked.
Reply to #1:

Steps:

1) Add the 'Replace' renaming method

2) In the 'Replace' field enter:

^(\b\w+\b)\s+(\b\w+\b)(.*)

3) In the 'Replace with' field enter:

$2 $1$3

(Note the space after $2, but NO space after $1)

4) Make sure 'Use regular expressions' is checked
Reply to #1:
Replace <Word:1>
Replace with <Word:2>
Occurrence 1st
Regular expression Checked

next
Replace <Word:2>
Replace with <Word:1>
Occurrence 2nd
Regular expression Checked
Reply to #3:

This looks like a fun game! :)

MG, HOBBS, you guys realize that David didn't ask a question, he supplied an answer... the only misstep was that regex doesn't need to be checked for that solution to work (but it can be, so no deductions from his score :)

MG, sorry brother, you forgot the comma. I do stuff like that all the time, don't feel bad. But why complicate an answer when David's solution worked?

HOBBS, sorry brother, you did what MG did: made the solution more complicated than the original. AND your solution doesn't take into account the added comma either (though that's an easy fix, of course).

Extra credit: What if some names are just one name, like Cher or Prince? What if some of the names have an extra part, like Canadian singer Coeur de pirate? In all honesty, I'm not sure how you are supposed to handle a name with "de" or "di" or "von"... I usually put it with the last name, since it was/is actually a modifier to the last name. Oh, and what if there were some Sam and Dave, or Sonny and Cher, in the collection? Middle initials, anyone?

EDIT: Sorry, just realized that if it were "Sam and Dave" there'd be no change: Try these:
Cher - Cherokee Nation.ext
Coeur de pirate - Some song name.ext
Elton John and Kiki Dee - Don't go breakin my heart.ext
Fantasia Barrino - Got me Waiting.ext

Personally I'd key off the " - " part of the filename and use the number of spaces (and the "and" or "&", and the existence of a one-letter "word", possibly followed by a period) to decide how to deal with the name part.

Feel free to play... or not. :)

Best,
DF
Reply to #4:

Well, *I* had fun playing... and that's what is important, right? :)

Six replace methods to reconfigure any singer/actor/whatever names. It can be one person or two people - I was hoping it would work on any number separated by "and" or "&", but it doesn't, for some reason I can't figure.

It would have been some fewer steps but I realized I needed to account for hyphenated names like Olivia Newton-John. That added two steps; I didn't really have to add the steps but I don't trust dashes (too long to explain), and it wasn't much to add a method at top and bottom to change the dashes to zeros before and back after processing the rest.

I ended up processing the names with "and" or "&" before the single names. I could probably make methods 3 & 4 into one method, but they are complex enough as is, and I don't want to have to think how that might break something else.

I had a method that took a 3-word name with middle name "de", "di", "von", "van", etc, and put that word before the last name, but I realized that Beethoven wouldn't look right as "van Beethoven, Ludwig", so I left it out. The last method just removes excess spaces introduced in the previous methods.
Screenshot: https://drive.google.com/file/d/1rajQ-9-Zj0jpEQAxxcV80K8m9MN YsSXx/view?usp=sharing
Anyway, here are the methods (all replace; I used R: and Rw: for replace and replace with. Case sensitivity and Regular expressions CHECKED, Occurrence: All and Apply to: Name for all methods. There is a space at the end of the replace-with on 2, 3, 4, and only a space on 6):

(1) >Change hyphenated names (name-name -> name0name)
R:\b([A-Za-z]+)\K-([A-Za-z]+)\b
Rw:0$2

(2) >Fix 2- or 3-word name NAME1
R:^(\b([A-Za-z0]+)\b\s+)?\b([^a&][A-Za-z0]*)\b(\.?)\s+\b([A-Za-z0]+)\b\s+(and|&)\s+
Rw:$5, $1 $3$4 $6 [trailing space]

(3) >Fix 2- or 3-word name NAME2
R:(and|&)\s+(\b([A-Za-z0]+)\b\s+)?\b([^a&][A-Za-z0]*)\b(\.?)\s+\b([A-Za-z0]+)\b\s+-\s+
Rw:$1 $6, $3 $4$5 - [trailing space]

(4) >Fix 2- or 3-word name [1 SINGER ONY]
R:^(\b([A-Za-z0]+)\b\s+)?\b([^a&][A-Za-z0]*)\b(\.?)\s+\b([A-Za-z0]+)\b\s+-\s+
Rw:$5, $1 $3$4 - [trailing space]

(5) >Change back hyphenated names (Name0Name -> Name-Name)
R:\b([A-Za-z]+)0([A-Za-z]+)\b
Rw:$1-$2

(6) >Multiple spaces -> single-space
R:\s+
Rw: [1 space]

EDIT: I just realized I didn't fix methods 2 and 3 to take middle initials with a period. I'm changing it now. Changed. END EDIT

If anybody has a better way - especially if it could accommodate more than two persons- I'd love to see it!

Best,
DF

Reply to #5:

...and a javascript version, which because I separated out the name part to work on as a discrete chunk, will handle any number of names (I tried up to four). It won't handle nicknames unless they are not delimited in any way, and it won't handle more than three words-plus-initials in a name.

name = item.newBasename ;
workLen = name.indexOf( " - " ) ;
wName = name.slice( 0, workLen ) ; // the part we're working on
wName2 = wName ; // ...and a copy to ping-pong
remainderName = name.slice( workLen + 3 ) ; // the part we're not going to change
// change any 2-3 word names before and/&
pattern = /^(\b([A-Za-z\-]+)\b\s+)?\b([^a&][A-Za-z\-]*)\b(\.?)\s+\b([A-Za-z\-]+)\b\s+(and|&)\s+/g ;
wName2 = wName.replace( pattern, "$5, $1 $3$4 $6 " ) ;
// change 2-3 word names after and/&
pattern = /(and|&)\s+(\b([A-Za-z\-]+)\b\s+)?\b([A-Za-z\-]+)\b(\.?)\s+\b([A-Za-z\-]+)\b\s*/g
wName = wName2.replace( pattern, "$1 $6, $3 $4$5 " ) ;
// change 2-3 word names with NO and/& (one person)
pattern = /^(\b([A-Za-z0]+)\b\s+)?\b([^a&][A-Za-z0]*)\b(\.?)\s+\b([A-Za-z0]+)\b\s*$/ ;
wName2 = wName.replace( pattern, "$5, $1 $3$4" ) ;
wName = wName2 + " - " + remainderName ; // rejoin filename parts
wName2 = wName.replace( /\s+/g, " " ) ; // remove extra spaces
return wName2 ; // send it back