grepadobe-indesigngrep-indesign

GREP to find a sequence of characters without a closing apostrophe


I'm trying to find long quotes in the text that I'm editing so that I can apply a different style to them. I've tried this GREP:

~[.{230}(?!.~])

What I need is for the GREP to find any 230 characters preceded by a left/opening quote mark, not including any 230-character sequence including a character followed by a right/clsoing quote mark. This should then eliminate quotes of less than 230 characters from the search. My GREP finds the correct length sequence but doesn't exclude those sequences which include a right quote mark.

So I want to find this, which my GREP does:

enter image description here

But not this, which my GREP also finds:

enter image description here

Because it has a closing quote in it and is therefore what I'm classing as a short quote.

Any ideas? TIA


Solution

  • You can match an opening followed by 230 or more occurrences of any character except an opening or closing quotation mark.

    To not match the closing quotation mark, you can assert it using a positive lookahead.

    ‘[^‘’]{230,}(?=’)
    

    See a regex demo.