flipping names exchange swap move first last name, firstname

A swapping-ground for Regular Expression syntax

flipping Swap exchange parts filename dash hyphen minus

Postby Stefan » Sat May 04, 2013 9:15 am

FROM:
Song - Artist.mp3
Song Title - Artist.mp3
Song Title - Artist name.mp3

TO:
Artist - Song.mp3
Artist - Song Title.mp3
Artist name - Song Title.mp3

Rule:
Match everything till an space-hyphen-space and store it in ()-group 1,
then match the rest till the extension and store it in group 2.
At the replacement reorder the stored matches and reference to group 2 first by using \2,
then add an hyphen literally your self and add \1 to 'paste' what was matched in group 1.

DO:
RegEx(1)
Search: (.+) - (.+)
Replace: \2 - \1


"[ ] Include Ext." is unchecked.
"Options > Ignore... > File Extensions" is unchecked.
Select a few files in the Name column to see what happens in the NewName column.


.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: flipping names exchange swap move first last name, firstname

Postby psychopython » Mon May 01, 2017 4:04 am

Its an old post. But still... here you go

8)


filename1 - filename2
to
filename2 - filename1
https://www.youtube.com/watch?v=C58Odqe2q6s


Match: (.*) - (.*)
Replace: \2 - \1
psychopython
 
Posts: 1
Joined: Mon May 01, 2017 3:54 am

Re: flipping names exchange swap move first last name, firstname

Postby LuckyMenace » Mon Jul 09, 2018 1:43 am

Some of the solutions above kind of work except these kind of scenarios:
Aldron T. Smith
Jane Doe-Smith
Jim Darling Jr.

I've been trying to get the following results:
Smith, Aldron T.
Doe-Smith, Jane
Darling Jr., Jim

Is this even possible in one step?
LuckyMenace
 
Posts: 1
Joined: Mon Jul 09, 2018 1:39 am

Previous

Return to Regular Expressions