GREP style: behind | until line end

1,348 views
Skip to first unread message

Thomas Olbrich

unread,
Sep 30, 2011, 12:24:48 PM9/30/11
to InDesign - Google Group
I'm just exercising GREP style again with poor programming skills and no success. 
In every line all text behind this char | (vertical bar) shall become a glyph style until the line end. 
Sample:

Line beginning in paragraph style | from here with glyph style 
New line without glyph style  |  glyph style again
New line … etc

I have tried this code (which still includes the | but must not!): 

\|\d{.,}\r


Nothing happens. - Any hints? 

Thank you!
- thomas


Michel Raj

unread,
Sep 30, 2011, 12:32:01 PM9/30/11
to indesi...@googlegroups.com
I would put all the line in a §style (italic glyph)
And the bold part ahead of the | in a charstyle




--
you are subscribed to "InDesign talk" on Google Groups, to post: send email to indesi...@googlegroups.com, to unsubscribe: send email to indesign-tal...@googlegroups.com, for more options visit http://groups.google.com/group/indesign-talk

Evans, Rebecca

unread,
Sep 30, 2011, 12:38:16 PM9/30/11
to InDesign list
Me too, with a nested character style you could set the paragraph style's font to italic and nest the bold character style up to the vertical bar, then perhaps a style through the vertical bar if you need one.

Rebecca

Roy McCoy

unread,
Sep 30, 2011, 12:45:32 PM9/30/11
to indesi...@googlegroups.com
How about with a look-behind? I just got a GREP style going with

(?<=\|).+$

but I don't know what you're doing with digits and punctuation.


Roy

Michel Raj

unread,
Sep 30, 2011, 12:48:29 PM9/30/11
to indesi...@googlegroups.com
And you could have this in the grep of the nested style
.+\|

Thomas Olbrich

unread,
Sep 30, 2011, 1:06:08 PM9/30/11
to InDesign - Google Group
nest the bold character style up to the vertical bar,

I had tried before but could not find a way to use a nested style up to a certain char/glyph. How can I?

- thomas

Thomas Olbrich

unread,
Sep 30, 2011, 1:10:12 PM9/30/11
to InDesign - Google Group
Thank's Michel, your code works like a charm. But unfortunately there are lines without | char, too. Those lines do appear in the wrong style.

Is there no way to style vice versa, means only those lines which have the | got changed?

Thanks,
- thomas

Von: Michel Raj <mr...@mac.com>
Antworten an: InDesign - Google Group <indesi...@googlegroups.com>
Datum: Fri, 30 Sep 2011 18:48:29 +0200
An: InDesign - Google Group <indesi...@googlegroups.com>
Betreff: Re: [ID] GREP style: behind | until line end

Evans, Rebecca

unread,
Sep 30, 2011, 1:16:30 PM9/30/11
to InDesign list
You can type pr copy and paste a character into the nested style's "through/until" definition spot (not sure what to call that little selection drop down).

If you have some pars with vertical bars and some without, I'd make the bold a nested style through the End Nested Style character. You could use a nested GREP style in that paragraph style to change the vertical bar to vertical bar + End Nested Style character, or just search and replace them manually.

Rebecca



From: Thomas Olbrich <t.ol...@osk.de>
Reply-To: InDesign list <indesi...@googlegroups.com>
Date: Fri, 30 Sep 2011 19:10:12 +0200
To: InDesign list <indesi...@googlegroups.com>

Michel Raj

unread,
Sep 30, 2011, 3:27:36 PM9/30/11
to indesi...@googlegroups.com
Okay, then you have to use the Look Behind

Your § style in the bold font
your char style for the glyph part

and this in the grep
(?<=\|).+

Michel

Michel Raj

unread,
Sep 30, 2011, 3:30:31 PM9/30/11
to indesi...@googlegroups.com
Sorry, this was what you asked at first, and it seems that it already had been suggested.

Regards
Michel

thomas olbrich

unread,
Sep 30, 2011, 4:03:28 PM9/30/11
to InDesign Talk - Google
Perfect GREP code! - Thank you Michel!

- thomas

Am 30.09.11 21:27 schrieb "Michel Raj" unter <mr...@mac.com>

>>>> New line Š etc

thomas olbrich

unread,
Sep 30, 2011, 4:07:00 PM9/30/11
to InDesign Talk - Google
No, sorry myself, I guess Rebecca gave usefull hints which I did not
understand ...

- thomas

Am 30.09.11 21:30 schrieb "Michel Raj" unter <mr...@mac.com>

>>>>> New line Š etc

thomas olbrich

unread,
Sep 30, 2011, 4:16:02 PM9/30/11
to InDesign Talk - Google
Am 30.09.11 19:16 schrieb "Evans, Rebecca" unter <rebecc...@unc.edu>

You can type pr copy and paste a character into the nested style's "through/until" definition spot (not sure what to call that little selection drop down).


Thank you, Rebecca! - I did not know that I can type or paste text/chars into that field in nested styles, too!
(meanwhile Michels GREP code works like a charm ;-)

- thomas

Evans, Rebecca

unread,
Oct 3, 2011, 10:04:29 AM10/3/11
to InDesign list
Don't forget that nested styles and GREP styles do not export to ePub
(unless Adobe announces something different today at Adobe MAX 2011).
There is a "turn grep styles to char styles" script and an "apply nested
styles" script available.

Because I work on books that likely all will become ePubs, I only use GREP
styles for things that I don't need in an ePub, like kerning URL slashes
or biblio em dashes. It takes me less time overall to apply characters
styles with Search & Replace than to go back and double-check everything
after running the un-nest/un-GREP scripts.

However, if I were putting together a complex document that would never be
an ePub, I would use every nested style and GREP style I could think of.

Rebecca

Michel Raj

unread,
Oct 3, 2011, 11:17:17 AM10/3/11
to indesi...@googlegroups.com
Thanks Rebecca, I didn't know that.
Where are these scripts available ?

Michel

Evans, Rebecca

unread,
Oct 3, 2011, 11:47:15 AM10/3/11
to InDesign list
This InDesign Secrets post has links to both those scripts as well as
others:

http://indesignsecrets.com/free-scripts-help-fix-word-formatting.php

"Apply Nested Styles" is one of Harbs' scripts, and "Turn Grep Styles 2
Char Styles" is by Adi Ravid.

Rebecca

thomas olbrich

unread,
Oct 3, 2011, 12:03:25 PM10/3/11
to InDesign Talk - Google
Thank you, too for this hint.

Though I am not expericenced in epub I wonder if it wouldn't work before
epub-export to release all text from any applied stlye without to change
look/formatting. (means: see the forth flyout from top in both style
palettes). ­ Or does an ePub need to keep text formatting as styles to make
the ePub work properly?

- thomas


Am 03.10.11 16:04 schrieb "Evans, Rebecca" unter <rebecc...@unc.edu>

Evans, Rebecca

unread,
Oct 3, 2011, 12:16:21 PM10/3/11
to InDesign list
InDesign styles become the CSS styles used in the ePub, either by creating
those CSS styles when you export from InDesign, or by mapping the InDesign
styles to existing CSS styles in an ePub template you want to use.

Rebecca
Reply all
Reply to author
Forward
0 new messages