Skip to main content
Inspiring
January 25, 2017
Answered

GREP styling on multiple lines

  • January 25, 2017
  • 2 replies
  • 2402 views

Is it possible to use GREP styling to automatically format something like this below?

The typical pattern is a Bold paragraph style on the second line. However, I want a different character style automatically applied when the previous line has the word REGULAR. Likewise, if the previous line has the word PREFERRED, then I want a second character style to automatically be applied.

Thanks for any help or suggestions.

    This topic has been closed for replies.
    Correct answer Peter Kahrel

    Find what: REGULAR\r\K.+

    Change to: <Leave blank>

    In the 'Change format' panel, set the character style you want to apply to the dollar amount.

    Find what: PREFERRED\r\K.+

    Change to: <Leave blank>

    In the 'Change format' panel, set the character style you want to apply to the dollar amount.

    \r stands for the paragraph break, \K means 'match any preceding text but don't include it in the replacement'.

    P.

    2 replies

    vinny38
    Brainiac
    January 26, 2017

    Hi

    Here's another workaround:

    You could use object styles and apply them to text frames.

    Combining the paragraph styles option AND the Next style option, it's quite handy in your situation:

    Brainiac
    January 26, 2017

    Nice one, Vinny. But you have to be typing for that, don't you?

    vinny38
    Brainiac
    January 26, 2017

    Hmmm not sure I understand what you mean pkahrel...

    Brainiac
    January 26, 2017

    How is this organised? Are e.g. 'REGULAR' and '$00.00' in a cell the same paragraph, separated perhaps by a forced or a normal paragraph break? Can you show a screenshot with special-character display on?

    Peter

    crizloAuthor
    Inspiring
    January 26, 2017

    This is constructed with multiple embedded text frames (set to auto expand when the text or currency changes because of foreign translation), each frame separated by an embedded line.

    Peter KahrelCorrect answer
    Brainiac
    January 26, 2017

    Find what: REGULAR\r\K.+

    Change to: <Leave blank>

    In the 'Change format' panel, set the character style you want to apply to the dollar amount.

    Find what: PREFERRED\r\K.+

    Change to: <Leave blank>

    In the 'Change format' panel, set the character style you want to apply to the dollar amount.

    \r stands for the paragraph break, \K means 'match any preceding text but don't include it in the replacement'.

    P.