Copy link to clipboard
Copied
Hi I'm relatively new to InDesign and have a GREP question. I have a list of hundreds of names that are separated by a semicolon. There isn't a consistent first, middle initial last pattern to the names as they are part of dedication so you can have individual names and family names, etc. As an example, a group of name can appear as:
First M. Last; First Middle Last; First Middle Hypenated-Last; First M Last; The Last Family; First and First Last; First & First M. Last
I'm trying to prevent the names from breaking to the next line before the semicolon so that a first name isn't on one line and the last name on a second line. I've attempted to grep between the semicolons and applying a nobreak style to the results (among a half dozen other things) to no avail. Could anyone point me in the right direction on how to accomplish this?
TY!
In a find/replace use this:
;\h\K.+?(?=;)
Copy link to clipboard
Copied
Try with this to apply a [No Break].
(?<=;\h).+?(?=;|$)
Copy link to clipboard
Copied
Hi @Jean-Claude Tremblay no luck. It's similar to the issues I was having, which is it finds the first match and then stops searching.
Copy link to clipboard
Copied
I see...
It’s working in a GREP Style.
Copy link to clipboard
Copied
In a find/replace use this:
;\h\K.+?(?=;)