2 Replies Latest reply on Jun 13, 2017 5:25 AM by Bartelby

    Indesign, GREP


      Bonjour !


      Je travaille actuellement sur des fichiers Indesign que j'essaie d'automatiser.


      Connaissez-vous une formule GREP qui permettrait de mettre tout mes débuts de phrases jusqu'au caractère ":" dans une style de caractère XYZ ?


      Je n'ai pas trouvé comment faire avec les styles imbriqués, il ne considère pas les phrases, seulement les paragraphes...


      Avec mes remerciements !

        • 1. Re: Indesign, GREP
          [Jongware] Most Valuable Participant

          So you don't want to start a match at a paragraph (which would simply use the GREP code ^) but at the start of a sentence – somewhere inside a longer paragraph? There is no GREP code to look for "start of a sentence"; you must define one yourself.


          The easiest definition is this: all sentences either start directly at the beginning of a paragraph, or after a period, exclamation mark, or question mark. That would be


          ((?<=[.!?] )|^)[^.!?\r]+:


          i.e., either period/exclamation/question mark + space or the Start of Paragraph, then followed by a sequence of not-(period/exclamation/question/return), followed by the colon. The reason for the negated repeated set is this: you can't simply use .+: at the end, nor the more restrictive .+?: because they both take the easiest route to not check the lookbehind, and so it first checks if the expression is valid from the start of the paragraph – which will always be true.

          • 2. Re: Indesign, GREP
            Bartelby Level 1

            Thank you so much ! It works perfectly.


            And thank you as well for your explanations, I know it's not the easiest (but it's not my design... so no choice there). I hop to be able to change it myself if the occasion comes.


            Thanks again !