Hello all - esp. the renaming wizards
I'm using D9.
I have a bunch (meaning: several thousands...) of files which I would like to rename. This is the general pattern of their current name:
Firstname Lastname - Some other stuff.txt
(so Firstname space Lastname space hyphen space some other stuff dot txt)
Example: Jim Lewis - First chapter.txt
I would like to rename this into:
Lastname, Firstname - Some other stuff.txt
(so Lastname comma space Firstname space hyphen space some other stuff dot txt).
Basically: find first- and lastname, i.e. the part before the hyphen, invert them, separate them by a comma.
Example: Lewis, Jim - First chapter.txt
I'm sure some clever regex could do this. Alas, my regex knowledge is virtually non-existant... So, is there any wizard out here who could help me??
My memory of that far back is fuzzy but I think the regexps in Opus 9 wouldn't have supported \S and \s, so if the expression doesn't work in 9 then that's probably why. (Still worth a try in case my memory is wrong.)
Just to be on the safe side for other users who might want to use the above solution: for me it works in the majority of cases, but be careful when there are more word-space-combinations involved in the first string. For instance:
John James Doe - Some stuff.txt
becomes:
Doe, James - Some stuff.txt
i.e. "John" is removed. For me, that doesn't matter, but I just wanted to point it out.
This is always a problem with using a simple word-match algorithm to detect First names vs. Surnames. There is no simple solution that works in all cases, nor often in general (depending upon name origin).
Some names are very complex: Juan Jose Montes de Oca. Which is the first name? Which is the last?
Can you answer a question for those of us who have forgotten. Did DOpus 9 support \s and \S ?