Skip navigation
Currently Being Moderated

Its is safe use a big list of words with alternatives (|) or better use another tool in Grep?

Mar 26, 2013 3:54 AM

I have lists with hundred of words that need to be tagged with Grep.

I would like to know if it is the right way or it is a wrong/dangerous method

 

Until the moment  the f/change Grep window is accepting these long strings but seems not very orthodox...

 

 

 

 

 

 

 

^(\w+)(\w+)\s(Abraham|Águeda|Agustín|Alameda|Alba|Alejandro|Alonso|America|América| America|América|Ana|Andrei|Andrés|Ángel|Angel|Ángela|Anselmo|Antoine|A ntonio|Antonium|Armando|Bárbara|Barbara|Bárbara|Barbaram|Bartolomé|Bau tista|Benito|Bernardo|Camilo|Carlos|Cayetano|Celestino|César|Clara|Cla udio|Constanza|Christian|Damien|Diana|Diego|Dieudonné|Dionisio|Dolores |Domingo|Donato|Eduardo|Edward|Eloy|Elvira|Emmanuel|Emmanuelem|Enrique |Enrrique|Esteban|Estenjo|Étienne|Eugenio|Eusebio|Eustaquio|Exmo|Fabio |Felipe|Félix|Fermín|Fernando|Francisca|Francisci|Francisco|Fulgencio| Gabriel|Gabriela|Gerald|Germán|Gillet|Gracia|Gregorio|Guillermo|Gustav o|Henrique|Hermes|Ignacia|Ignacio|Ildefonso|Indalecio|Inocencio|Isabel |Isabela|Jacinto|Jaime|Javier|Javiera|Joaquín|Jorge|José|Josef|Josefa| Joseph|Juan|Juana|Julián|Just|Justo|Laurent|Louiche|Lucas|Lucía|Luis|M anuel|Marcos|María|Mauricio|Nepomuceno|Nepomuceno Camacho|Nicolás|Olga|Pablo|Paula|Pedro|Pumarino|Ramón|Renán|Ricardo|R oberto|Rosa|Rosalía|Santiago|Saturio|Segunda|Segundo|Silvestre|Simón|S inforoso|Socorro|Tadeo|Tercera|Tomás|Toribio|Vicenta|Vicente|Victorian o|Vladimir|Vladimir|William|Xavier|Yolanda|Zenón)\s(\w+)$


 
Replies
  • Currently Being Moderated
    Mar 26, 2013 5:01 AM   in reply to camilo umaña

    Jonware or Peter K will have more to say about whether this is a good idea, but I don't see an inherent problem other than a potentially big performance hit.

     

    That said, these are all capitalized words that don't start a paragraph. Do your paragaphs have more than one sentence? If not, would there ever be a Capitalized word not starting the paragraph thar you would NOT want to match? If not, perhaps the simpler ^\w+\s\u\l+ would work.

     

    I don't think there's any functional difference between ^(\w+)(\w+) and just \w+ but you  might need to include the \s\w+$ at the end if you want to limit the match to three word paragraphs. Maybe you meant ^(\w+)\s(\w+) to pick up the third word in a four-word paragraph?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2013 5:06 AM   in reply to Peter Spier

    You probably need to add spame parnethesese to my expression if you are trying to rearrange or susbstitute the individual words, but as your query is structured it cannot apply a style to just those listed words, but will apply any formatting to the entire match.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2013 5:07 AM   in reply to Peter Spier

    Boy, I really can't type this morning. Let's try again:

    You probably need to add some parentheses to my expression if you are trying to rearrange or substitute the individual words, but as your query is structured it cannot apply a style to just those listed words, but will apply any formatting to the entire match.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2013 9:43 AM   in reply to camilo umaña

    It would probably help if you tell us what you are trying to do in detail.

     

    As I mentioned, with no space between those first two (\w+) groups, they find only the first word, so this may not be working as well as you think, or possibly it's just a typo in what you entered here.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 26, 2013 1:39 PM   in reply to camilo umaña

    Since I don't know exactly what you expect to do with the GREP, I can't offer another method (or even an alternative GREP expression that would be less cumbersome).

     

    And I'm not clear, I'm afraid, on what the difference is between another method and an alternative tool.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points