2 Replies Latest reply on Apr 24, 2013 1:21 AM by Eugene Tyson

    Simple grep question - I guess

    Lars Bo Zhou Yi Level 1

      I need to add a character style to anything inside two quotation marks, but GREP is still a bit too sophisticated for me.

      Anyone who will help poor me with a search string?

        • 1. Re: Simple grep question - I guess
          Peter Spier Most Valuable Participant (Moderator)

          Do you need to add the character syle to the marks, too, or just what's inside them?

          1 person found this helpful
          • 2. Re: Simple grep question - I guess
            Eugene Tyson Adobe Community Professional & MVP



            Then in the Change Format select your character style.


            GREP is really simple if you break it down into what exactly it is you need.


            You're looking for “ANY TEXT”


            But you don't want to include the Quoatation Marks - just the text between them



            With GREP it can look behind and in front for certain things - in this case it works because you're looking for a Left Quotation followed by a Right Quotation


            These are called Possitive Lookbehind and Positive Lookahead


            It's classed as "Possitive" because you do want to find that text but not include it in the Found results.



            (?<=) & (?=)


            Indicate a Possitive Lookbehind and a Positive Lookahead


            You need to include whatever text you are looking for after the "=" sign - in this case it's a Left Quotation Mark:



            And Similarly you are looking for a but don't want to include in the found text a Right Quotation Mark



            So far we've got



            But this tells InDesign not to include any of the quotes in the found text - as it's looking Behind and Looking Ahead - but not including the Quotation Marks


            Now you need to tell it what to find


            . = any character

            + = keep going





            Finds all text from "ANY TEXT" to any text to any text "TO ANY TEXT"


            And that simply won't do - so we need to tell indesign when to stop and we do this by adding a REPEAT command


            Which is ? in this case





            Tells indesign to

            Lookbehind for a Left Quotation Mark but don't include it in the found results

            Find any character

            Keep Going

            Repeat Zero or One Time


            Which basically means find

            "ANY TEXT" to any text to any text "TO ANY TEXT"