Page 1 of 1

Firstname Lastname to Initial Lastname

PostPosted: Fri Nov 17, 2023 11:54 am
by Ixion73
I'm Sorry if this has been asked for before.

But I just need to rename 2000 files with Initial Lastname

Someone sent me a bunch of files that currently have Firstname Lastname

Re: Firstname Lastname to Initial Lastname

PostPosted: Fri Nov 17, 2023 12:04 pm
by Admin
Hi, what is the separator? Do you have some examples?

Re: Firstname Lastname to Initial Lastname

PostPosted: Fri Nov 17, 2023 12:05 pm
by Ixion73
Hi Sorry the only seperator is a space

So like
John Smith
William Bragg
Judith Chalmers

And so on

Re: Firstname Lastname to Initial Lastname

PostPosted: Sun Nov 19, 2023 10:24 am
by Admin
Hi, you can swap around space using:

RegEx (1)
Enable option "Simple" in RegEx (1)
Match: %1 %2
Replace: %2 %1

However if the first name contains a space it will not work properly.

Re: Firstname Lastname to Initial Lastname

PostPosted: Mon Nov 20, 2023 6:37 am
by Ixion73
Hi

Thanks for this reply, this just swaps first and last name.

I need Joe Bloggs to turn into J Bloggs

TIA

FirstName LastName --> FirstInitial LastName

PostPosted: Mon Nov 20, 2023 8:05 am
by Luuk
With leaving the checkmark inside for "Simple", could try something like...
%1%2 %3
%1 %3

Without the checkmark, could also try something more complicated like...
^(.)[^ ]+( [^ ]+)$
\1\2

Re: Firstname Lastname to Initial Lastname

PostPosted: Mon Nov 20, 2023 10:34 am
by Ixion73
This worked perfectly

Thanks

Re: Firstname Lastname to Initial Lastname

PostPosted: Tue Nov 21, 2023 5:22 pm
by therube
%1%2 %3
%1 %3

Took me a moment to realize what you were doing there.
(And it was something I'd not thought of.)