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: Replace but also Ignore

Return to Member Forum

  • Author
    Posts
    • #14361419

      We often have numbers in our documents followed by a foot or inch symbol. With typographer’s quotes being on, those symbols become curly quotes. I’ve been working on a GREP expression to search and replace the single and double curly quotes and to straight quotes when followed behind numbers, except ignore the single apostrophe when it’s followed by an “s.” Using Find/Change I was able to find the single apostrophe and replace it… however, once I added the part to the expression to ignore the ‘s, it finds the apostrophe, plus the space or hyphen next to it. Here’s my example:

      200′ of string (need to change curly to straight in my document)
      5’-6″ wall of art (need to change curly to straight in my document)
      2000’s (need to ignore this type of instance)

      GREP I’m using: ‘[^’s] … it ignores the ‘s but then picks up ‘and the space next to it, and ‘- (plus the hyphen)—in both cases, the apostrophe does change to straight, but it removes the space and hyphen.

      I’m teaching myself GREP and doing pretty good with some expression, but this one has me a bit stuck. I’m not sure if I should be using one of the Lookarounds or not… any help is appreciated.

    • #14361421
      Dhafir Photo
      Participant

      Try this: \d\K[?’?](?!s)

      • #14361422
        Dhafir Photo
        Participant

        In my previous answer, for some reason the quote marks appeared a question mark, use this, or put what yo need in brackets:
        \d\K[\x{2019}\x{2032}\x{2033}](?!s)

    • #14361427

      Thank you Dhafir… both expressions worked the same. They both found the apostrophe and ignore the ‘s. Now a follow-up question. In my example, I have both single and double quotes (5’-6″) that will need be straight. Would I have to search and replace the single separately from the double? Or is there a way to create a search for both with a Change To for both, maybe using a “found” option?

      Also, as I’m still learning, an explanation of the expression would be helpful. I believe in the second expression sent, you added Unicodes, correct? Thanks again…

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