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

InDesign GREP: Apply Character Style to multiple objects after a tab

Community Beginner ,
Feb 11, 2023 Feb 11, 2023

Copy link to clipboard

Copied

Hi All, I've been trying to change colours of whole stand listings through GREP styles in InDesign for a exhibitor list but I'm getting an error that I can't get past. I've set up character styles to denote different colours depending on what the first letter of the "stand" is eg. TA = light blue, 2 = green, etc.

 

This is an example of a line:

<paragraph open>TAEKwondo <tab> 2F34; 3G29; EW8; TA19 TA20 TA21<end of paragraph>

 

This is the GREP style for TA that I have set up:

(?<=\t)*\<TA\w+\>

...but it's still applying to TAEKwondo even though I've got a positive lookbehind on a tab.

 

Am I close or way off?

 

Thank you in advance,

TOPICS
How to

Views

310

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 Beginner , Feb 12, 2023 Feb 12, 2023

Thank you so much Eugene, but I've created something that works:

 

(?<=\t)*\<TA\w+\>

...which will find all instances that start with TA

 

Last GREP style in the sequence:

Apply Black character style:

(?<=^).+(?=\t)

To any character between the start of the paragraph and the start of the tab

 

Really appreciate your help,

Votes

Translate

Translate
Community Expert ,
Feb 11, 2023 Feb 11, 2023

Copy link to clipboard

Copied

The regular expression (?<=\t)*\<TA\w+\> would try to match a word that starts with "TA" and is preceded by a tab character. However, the use of the asterisk after the positive lookbehind assertion  (?<=\t) is not valid and would likely result in an error or unexpected behavior.

 

You just need a different qualifier instead of a tab character

This works based on your sample which I put 3G29 inbetween TA to make sure it was working

EugeneTyson_0-1676185183800.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
Community Expert ,
Feb 11, 2023 Feb 11, 2023

Copy link to clipboard

Copied

\h represents any space character - nonbreaking, hair space, tab etc.

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 Beginner ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

Thank you very much for your suggestion Eugene but that does not work because it does need to incorporate the option of having *only include items after the tab*

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 Beginner ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

This visual might help

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 ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

The reason why it doesn't work with the tab is because it's always going search in a logical order.

 

Text <Tab> Text

 

Why this does not work is because the qualifier is the tab - then it's looking  directly after the tab for the number or the text which in the example below only illustrates 1 number as expected

EugeneTyson_0-1676193299333.png

 

 

A simpler approach would be to apply different paragraph styles

EugeneTyson_1-1676193915417.png

 

The only one with No Colour style applied is the bottom line of text which has no Tab character. You'd have to find the lines of text with a tab with a search. And apply the paragraph style.

 

Then the coloured style is done the same way

EugeneTyson_2-1676193980370.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
Community Beginner ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

Thank you so much Eugene, but I've created something that works:

 

(?<=\t)*\<TA\w+\>

...which will find all instances that start with TA

 

Last GREP style in the sequence:

Apply Black character style:

(?<=^).+(?=\t)

To any character between the start of the paragraph and the start of the tab

 

Really appreciate your help,

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 ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

LATEST

I've a sneaking suspicion this shouldn't be working the way you have it - and it might affect the document if InDesign is updated... it's a bit peculiar but hey if it works.

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