Skip to main content
Participant
November 30, 2022
Question

GREP InDesign re-arranging multiple names

  • November 30, 2022
  • 3 replies
  • 294 views

Hi,

I have a huge list of names that need to be ordered: Firstname Middlename Lastname

 Currently they are ordered like the following on the left (I've picked a couple of name variations)

 

Butcher Thomas - (Butcher: lastname) (Thomas: firstname)

de Boag Michael - (de Boag: lastname) (Michael: firstname)

Holland-Kemp Kelly - (Holland-Kemp: lastname) (Kelly: firstname)

Pitt Avery Mae-Anne - (Pitt: lastname) (Avery: firstname) (Mae-Anne: middlename)

Smith John Peter - (Smith: lastname) (John Peter: firstname)

 

I can re-arrange 2 names fine, but was wondering if there was any Grep that arranges variations like the examples above in a single document PLUS ordered alphabetically according to their last names?
Sorry if that's confusing...and I know it's a big ask. Any help would be appraciated. Thanks!

This topic has been closed for replies.

3 replies

Mike Witherell
Community Expert
Community Expert
December 16, 2022

Already embedded within InDesign is a script (Scripts > Application > Samples > JavaScript > SortParagraphs.jsx which will sort alphabetically. That is half your battle, anyway.

 

A GREP might be: ^(.+)\s(.+) and change to $2 $1. It would leave behind the awkward name patterns that you might clean up manually.

Mike Witherell
Inspiring
December 16, 2022

Replying late to this as I just saw it, but if most of the names in your list are single firstname, single lastname, it probably wouldn't be too hard to find the outliers and manually join them where you don't want them to break, do the transposition using GREP and then replace the join characters with spaces. Here's what I mean: 

 

Butcher Thomas

de#Boag Michael

Holland-Kemp Kelly

Pitt Avery#Mae-Anne

Smith John#Peter

 

Find Grep: (.+) (.+)

Change Grep: $2 $1

 

Then find-change # to space. 

Community Expert
December 4, 2022

There would be no way. You'd need a pattern.

Thomas

Micheal

Mae-Anne

John Peter

 

All have different patterns

Partnered with double barrel surnames, surnames singular.

 

There's no way to distinguish

Holland-Kemp Kelly

Pitt Avery Mae-Anne

Smith John Peter

 

The pattern is too diverse.