Originally Posted by garcle
How is your Regex knowledge?
The "simple" way to do this is to select ONLY the books that have the authors first and last names reversed, and perform a bulk metadata edit (press the E key after Ctrl Selecting the books you want to fix).
Then Go to the Search and Replace Tab.
Select [Authors] in the Search Field
Select [Regular Expression] in the Search Mode drop-down Field.
In the Search for: field enter (.*), (.*)
In the Replace with: field enter \2 \1
(check in the Test results table that the expected reversal will take place)
Make sure you have selected ONLY the books with the reversed names!
Make Sure you have backed up your library !!
Cross your fingers
Then Click OK
Calibre will update the Author-Sort field automagically at the same time.
The regular expression shown (.*), (.*) will only work for authors that are entered as LastName, FirstName i.e. it expects one comma and one space between a single last name and (one or more) first name(s).
i have a very similar problem that i have filenames in two groups;
1) Hide & seek_ a novel - James Patterson
2) Hide & seek_ a novel - Patterson_ James
i have been trying to change filenames 1) to 2) use the 'Search and Replace Tab' as discribed above method with a few variations but without any success.
as there is no , between the fisrt and last name i just can't get the [Regular Expression] to work.
any help could be much appreciated. many thanks in advance.