Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Grep expression to find repeated phrases

Return to Member Forum

  • Author
    Posts
    • #1183493

      Hello everyone
      I need a grep expression that finds repeated phrases, not just repeated words. For example, the words “for the” was repeated twice in a document and missed during spell check “for the for the first time”. Is there a grep expression that can find duplicate phrases.

    • #14324199

      Yes there is!

      You do not mention what GREP you use to find duplicate words, but it may be something like this:

      (\w+) \1

      — search for start of word, a number of “word” characters, followed by a space and that word again. To find two words repeating, expand the parenthesized phrase to

      (\w+ \w+) \1

      so it will match “word word” followed by a space and that first match again.

    • #14324198

      Thank you so much, the second grep expression worked fine.

Viewing 2 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads