• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

GREP styling on multiple lines

Explorer ,
Jan 25, 2017 Jan 25, 2017

Copy link to clipboard

Copied

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.

Views

1.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 25, 2017 Jan 25, 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.

Votes

Translate

Translate
Community Expert ,
Jan 25, 2017 Jan 25, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 25, 2017 Jan 25, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2017 Jan 25, 2017

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

Hello Peter,

i read this that the poster wants his text "automatically" formated.

How about…

Bildschirmfoto 2017-01-26 um 13.27.08.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

Edit: Arrrg, just saw "multiple lines", which is notghing for GREP working within a paragraph.

But maybe you could cheat in that case and use a single paragraph, and format the second line to look like a new paragraph (e.g. space_after to baseline_shift)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

Well, if he wants to use a grep style then, as you say, he'll have to replace the paragraph breaks with forced paragraph breaks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

LATEST

Thanks, pkahrel. Although not automatic, the Find/Change feature actually works perfectly and will be very helpful.

Thanks very much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

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:

pattern.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

Vinny: If you apply that object-style, it works like a charm.

But if you change text in that text-box, the object-style gets a + and doesnt auto-reformat – you have to use "delete differences" to make it look right.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 26, 2017 Jan 26, 2017

Copy link to clipboard

Copied

DBLjan: Yes, that's right, if you select both paragraphs. (not if you change only price i.e.)

Not knowing the op's workflow, I can't tell much more about what would be the most suitable solution: GREP, object styles, Search/Find, etc...

It's just a workaround... OP will choose ^^

Now, if I stick to the original request, I would vote nested GREP, after having replaced ¶ by ¬ as you both suggested.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines