How to swap First Name and Last Name separated by

Advanced Renamer forum
#1 : 30/04-25 11:38
Kigey
Posts: 5
Hi all, I just found out this awesome program and gave it a go. I'm very new to this and unable to get the desired results for a few files with titles as below,

01. John Legend - All of Me (Tiësto's Birthday Treatment Remix - Radio Edit).mp3
02. Martin Garrix - Animals.mp3
03. Dillon Francis - Get Low (Rebirth in Paris).mp3

I used this Regular Expression from the User Guide,

Text to be replaced: (.*) - (.*)
Replace with: \2 - \1

While this worked well for the titles which didn't have numbers at the beginning of the title. But, the results for the above examples were something like this,

Radio Edit) - 01. John Legend - All of Me (Tiësto's Birthday Treatment Remix.mp3
Animals - 02. Martin Garrix.mp3
Get Low (Rebirth in Paris) - 03. Dillon Francis.mp3

Can somebody help me through this. Would be really helpful. TIA.

edited: 30/04-25 11:46
#2 : 30/04-25 13:55
Miguel
Posts: 185
Reply to #1:
Hi Kigey.
I guess what you want is to change the order of the words.

You must capture the number of the track, the artist name and all the rest.

Use the next regex:
REPLACE: ^(\d+\.\s)([^-]+?)\s*-\s*(.+)$

REPLACE WITH: \1\3 - \2

^(\d+\.\s) This capture the track number with the period and the space.
([^-]+?) This capture the artist name (everything up to the first hyphen.
(.+)$ This capture the title of the song

I hope that work with all your files


#3 : 30/04-25 14:07
Kigey
Posts: 5
Reply to #2:
Holy!!! That worked perfectly. Thanks a lot for helping me. One last question if you don't mind. I want to remove the numbers as well, I tried the Remove Method and Numbers Type, it just takes away the numbers and not the "." and space before the title. What am I doing wrong here?

Edit: Thanks again for the explanation of Regular Expressions.

edited: 30/04-25 14:08
#4 : 30/04-25 15:16
Styb
Posts: 176
Reply to #3:
Hi,
try setting the Remove type to Position, start at 1 and count to 4.
#5 : 30/04-25 15:20
Miguel
Posts: 185
Reply to #3:
Hi,
Glad to help you.
For remove the numbers select Position:

Remove Type: Position
Starting: 1
Count: 4 (This will remove the numbers, the "." and the space)

#6 : 30/04-25 15:32
Kigey
Posts: 5
Thank you all for your quick response. That worked exactly how I wanted. Such a great community.
#7 : 30/04-25 15:33
Kigey
Posts: 5
Reply to #4:
Worked perfectly. Thank you.
#8 : 30/04-25 15:33
Kigey
Posts: 5
Reply to #5:
Worked Perfectly. Thank you.