You must be logged in to post Login

Search Forums:


 






GREP Help for Multiple Names

UserPost

3:39 pm
August 31, 2011


Ekwoman

New Member

posts 2

I'm creating a very long GREP string to use in ID's Find/Change and I have one component I can't figure out. I thought it was working because all of my names in the list originally consisted of a person's first and last name (no middle names allowed). However, some names still have multiple words…for instance the name "Steven van der Berg." Since I need it to find the whole name (so that it can be removed in the "replace" section of Find/Replace), I'm stuck.

My code for finding the 2 name string:

[A-Z]*[a-z]* [A-Z]*[a-z]*

NOTE: There is a space between the two sets. I can't figure out how to tell it that there may also be another space (or not) and another word (or not, or two, etc.).

Any help would be appreciated. Also, if there's a less verbose way to have it find a name, please let me know. I need it to find all:
Bob Smith
Bob van der Berg
Bob Del Toro
Bobby Jo Smith 

Because this will be set off as one group and not returned (stripped out), I'm having quite the issue…thanks!

-Erica Gamet 

1:28 am
September 1, 2011


Jongware

Member

posts 763

Post edited 1:29 am – September 1, 2011 by Jongware


Your sample names are all on a single line. If that's what you have right now, all you need is to find everything that's on a single line …

If not, there are a couple of other avenues you might proceed into (or something — I'm mixing metaphors I think).

Your own suggestion is a valiant try but will also match any two words, even starting with a lowercase! That's because of the use of the * operator – zero or more. You are also limiting yourself to accentless names … which might be okay if they are all American :) but hey, let's go nuts.

Try this one:

\u\l+( \l+)*( \u\l+)+

5:15 pm
April 11, 2012


ropapareli

Brazil

Member

posts 21

Hi Jongware,

I just started to taste the power of greps. So far I am in love… saved me a countless time of unnecessary work, with two days of study only! It is a miracle maker.

So, I was trying to use this one you describe above for some brazillian city names. Like you said, they have accents! Like this one: "São Bernardo do Campo"

What I want to do is to add a grep style to my paragraph style setting a more condensed style for the bigger names, with 3 or more words.

This grep selected the 2 words names like "São Paulo", the 3 words names like "Mogi das Cruzes" but didn't work for "São Bernardo do Campo", selecting only the 2 first words "São Bernardo".

I don't know enough to write my own greps yet but I tried and did some very simple ones. But I honestly don't understand this one yet… I am not even close! lol

This is not an emergency… I can edit those names one by one and make the little devils look right but… I wanna learn. And I am curious to know if this one should work in this case.


Thank you in advance!