Switch First and Last name

Bulk Rename Utility How-To's

Switch First and Last name

Postby svjathi » Tue Aug 19, 2025 2:15 am

I have a bunch of files that have the following structure:
LastName,<sp>FirstName<sp>-<sp>NameOfTheBook (LastName followed by a "," and a space, and then the FirstName followed by a space followed by "-" and then a space and then the NameOfTheBook)

I would like to change the structure to the following:
FirstName<sp>LastName<sp>-<sp>NameOfTheBook (FirstName followed by a space and then the LastName. The remaining portion starting with the space end culminating with the NameOfTheBook should rename the same.)

How do I achieve this via Regular Expression?

Thanks
Venkit
svjathi
 
Posts: 2
Joined: Tue Aug 19, 2025 2:02 am

Re: Switch First and Last name

Postby Admin » Tue Aug 19, 2025 2:20 am

Enable the "Simple" flag in Bulk Rename Utility RegEx (1)
Match: %1, %2 - %3
Replace: %2 %1 - %3

Explanation:
%1 captures the LastName before the comma, the literal ", " matches the comma and space, %2 captures the FirstName before the space-hyphen, the literal " - " matches the space, hyphen, space, and %3 captures the NameOfTheBook.
Example:
Before: Doe, John - MyBook
After: John Doe - MyBook
Admin
Site Admin
 
Posts: 3054
Joined: Tue Mar 08, 2005 8:39 pm

Re: Switch First and Last name

Postby svjathi » Tue Aug 19, 2025 8:06 pm

Thanks for the reply. Worked Wonderfully.

Venkit
svjathi
 
Posts: 2
Joined: Tue Aug 19, 2025 2:02 am


Return to How-To