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 help needed (finding all instances of words)

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #79267

      Hi. I’ve been trying to build this all myself, and for a while thought I had a working version, but I discovered this morning it’s been missing a statisticaly significant number of instances and I’m tearing my hair out trying to make it work (no programming background).

      Context: I am using InDesign and GREP to hack my editing process (I’m a graphic designer by day and a fiction writer by night). I load my story/article and then use GREP to find a list of words and attach a character stylesheet turning them bright pink to make them easier to rewrite (this way, when I am deep in the depths of a novel, I don’t have to remember which words to be on the look out for because they are all glaring at me). There are over 100 words on this list. So far. So find/replacing each one is a very tiring process.

      I WAS originally using an expression like this: “very | really | okay | just |” which found lots, because I was working on a 180,000 word novel and so there was plenty of text to explore. However, I noticed this morning that it’s been missing all instances that are capitalized, or have a punctuation mark or a hard return after it, and some instances that I can’t figure out at all what they have in common.

      I’ve been digging around in the findchangebylist.js but I’m in over my head. Any help would be appreciated.

    • #79268
      David Blatner
      Keymaster

      Yes, grep is extremely precise. But you can turn off the case insensitivity with a code. For example, this should work: (?i)(very|just|okay|really)

      • #79270

        Never mind! I found it–word boundaries–

        (?i)(very|just|okay|really)

        does the job! Catches things even with a period or a comma! Hooray! :D

    • #79269

      …thank you for that! It solves the case insensitivity issue. However removing the spaces means that it finds instances inside other words (such as “adjustment” or “everything”). Is there a way to code in “whole word only”?

    • #79288
      Peter Kahrel
      Participant

      The two should prevent finding ‘just’ in ‘adjustment’, etc. matches only at word boundaries.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
Forum Ads