Skip navigation
kenrou123
Currently Being Moderated

Find and replace words

Mar 28, 2012 7:35 AM

Hello every body

 

how can i find words start with letter r and end with letter t (as example)?

 
Replies
  • Currently Being Moderated
    Mar 28, 2012 8:14 AM   in reply to kenrou123

    I'd use a GREP search:

     

    \br[a-zA-Z]+?t\b

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 2, 2012 7:11 AM   in reply to kenrou123

    \b is a word boundary, so it marks the start of your word. r is the letter r at the start of the word. [a-zA-z] is a class that contains all upper and lowercase letters from a to z. the + signifies "one or more matches" and the ? is a shortest match limiter (which I think is not required here). t is the letter t at the end of your word, and \b is the word boundary signifying the end of the word.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 2, 2012 8:43 AM   in reply to Peter Spier

    I think Peter's right, that the ? isn't strictly necessary here, since the found string is already limited by the word boundaries and the character set to search on doesn't include punctuation or spaces. It won't hurt anything either.

     

    Re: the + meaning one or more match, what this means is that it will find anything that begins with r and ends with t, no matter how many letters are in between. So all of the following would be found using that GREP:

     

    rat

    rot

    root

    robot

    retirement

     

    Jongware has an extremely helpful script called "What the GREP" (a free download) that will pull apart any GREP string and tell you exactly what it's doing:

     

    http://www.jongware.com/idgrephelp.html

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 2, 2012 10:24 AM   in reply to kenrou123

    The best intro to GREP in InDesign is Peter Kahrel's "GREP in InDesign CS3/CS4," well worth the $10.

     
    |
    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