I would like to apply a GREP style to all words after a double line break (before the next line break). Basicly highlight all the titles in the document. What would be the code for that?
1 Answer
You should never, ever use multiple line breaks... If your text reflows, line breaks could be located on top of a column or a frame, which is definitely not what you want (see example below).
I strongly suggest you get rid of them, and apply a specific paragraph style to your title, with some space before.
Assuming your document is already set up this way, you can use the Search/Replace Grep feature to get rid of those multiple line breaks while applying Title paragraph style.
Searching (^\r\r)(.) and replacing by $2 should do the trick.
Note that in your screenshot, we can see a unwanted space before line break, which won't allow this Grep query to work properly.
Example:
-
As you assumed my document was prepared this way. I could get rid of the double line breaks (and thanks for the tip btw) but i think that is the only way i can identify a line as a title, and it could prove quite usefull if I knew the GREP code to point on it. Do you have any idea how I could get the first mentioned task without them? I really dont want to higlight and change the style of 200 titles one by one :D :D Apr 21, 2017 at 11:00
-
Sorry but I don't understand what you mean nor what you want. If you prepared your doc with multiple line breaks, just follow the example given in my answer...– VinnyApr 21, 2017 at 11:43
-
Unfortunately, I'm bad with GREP, so I can't give you the code you are looking for. But, @Tee Jey Jeytee84, I think Vinny's instructions should take care of the problem you have AND remove the double character returns. Once you follow the instructions, you will be able to see which lines are titles by the fact that they are formatted in your Title paragraph style. You will probably also want to change your standard paragraph style to have a space after (or before), so that you continue to see the spacing between the titles and the text.– magerberApr 21, 2017 at 15:32