3 Replies Latest reply on Nov 28, 2014 1:38 AM by [Jongware]

    GREP question

    RuneEilertsen Level 1


      I´m trying to apply a new paragraph style and remove a character style from the first line (up to, and including the first carriage return) in a paragraph. There is nothing in the text to identify this line and it may or may not include more than one word/numbers etc.


      I have been trying to use grep search and have managed to catch the first line, but the problem is the removal of the character style. Then I have to select all the text on that first line.


      As a bonus, it would have been very cool if the search query could understand that I dont want line 2, 3, 4...all tagged with the same style, but only the first line after the "Heading" style. This repeats over and over again, page after page.... §Head 2 -> §List style -> §body. I want to change the first line in §List style to a new paragraph style.


      Is this possible at all?



        • 1. Re: GREP question
          Peter Spier Most Valuable Participant (Moderator)

          Paragraphs can have only one paragraph style, applied the entire paragraph. You can use a nested Line Style to apply a character style to one or more whole lines, applied as part of a paragraph style.

          • 2. Re: GREP question
            RuneEilertsen Level 1

            Hi Peter,


            Thanks for answering.


            I do know that there is one style pr paragraph, and that my description of my problem is a bit messy. I have included a screenshot example to better explain it. I might want to add character styles to this first line paragraph later, so I prefer using a paragraph style on this one.


            In my example, the first section of text after the Heading, all have the same paragraph style assigned. I want to remove the italic style and replace the paragraph style only on this line. Basically to create another heading, Heading 2, and leave the following lines alone. I could maybe search for both the character style and the paragraph style, but the problem is that in some cases the italic style is applied to paragraphs I dont want to change.

            Skjermbilde 2014-11-28 kl. 00.26.52.png

            • 3. Re: GREP question
              [Jongware] Most Valuable Participant

              (Untested) Search for




              and put your ListStyle style in the Find Format field, and the other paragraph style and Character Style [None] in the Change Format field.


              .. Okay, just tested it and it does not work. This does




              but there seems no way to include the hard return at the end as you asked.