How to give a color to each letter of a word using GREP Style ?

Explorer ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

Hi,

I would like to give colors to some letters.

For example, let's say I have the word "Word", I want this result : "Word".

I created 4 Characters Styles, each with a different color, now, I need to find how to "select the letter X of the word << Word >>".

Any idea please 😄 ?


TOPICS
Type

Views

203

Likes

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
Adobe Community Professional ,
Jan 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

Some context would be nice. Does this need to occur for a specific word or any word? Only four letter words? ALL four letter words? will there be other text in the paragraph? All of these will affect the solution.

Likes

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 17, 2022 Jan 17, 2022

Copy link to clipboard

Copied

There are other words in the paragraph, specific Word. 

Likes

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 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Any idea 😛 ?

Likes

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
Adobe Community Professional ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

What is the specific word? Will it appear more than one time in a paragraph? If it does, should all occurrences be treated the same?

Likes

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 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

"Pneumonoultramicroscopicsilicovolcanoconiosis" xD . Joking, but I dont think knowing the specific word can help us here, I would like a generic procedure to apply it on every word I would like.

Let's say it's present one time in each paragraph, but an answer for all possibilities where all occurences must be trated the same way is also interesting.

Likes

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
Adobe Community Professional ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Unless there is something unique about your word (or list of words) you won't be able to identify it (them)using GREP. GREP matches patterns, so that pattern cannot exist anywhere you don't want to apply your style.

Likes

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 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Okay, now we have a word, what could be the procedure ?

Likes

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
Advisor ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

Simplistically:

 

Find/Replace “word” and insert a non-joiner before it, as:

 

Find: \bword\b

Replace by: ~j$0

 

Including Grep Styles in the para style as:

 

~j\K\w + color1
~j\w\K\w + color2

~j\w{2}\K\w + color3

~j\w{3}\K\w + color4

~j\w{4}\K\w + color5

...

 

(^/)  The Jedi

 

Likes

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 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

I would like solution that I could use with a MergeData, I cant use find & replace (I didnt think it would involve a F&R solution so I didnt precise it, sorry).

If I understand well, this is what you propose :

 

- "Find << word >> between boundaries"
- "Store the data << word >> into the clipboard by replace it by << ~j >>"

Next, I dont see what it is, is it "find what is stored in ~j then apply a style to the letter number N from the left" ?

Likes

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
Advisor ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

Nope! ...

 

You just need to insert the non-joiner before “word”!

 

... and it will be automatically colorized through the Grep styles.

 

About the use of “data merging”, you can run a F/R after it!

 

(^/)

Likes

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 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

There is not "step" after my DataMerging in my process, the file must not be modified.

What is a non-joiner ? The tilde " ~ " ?

I can add special characters in my text, can you give me an example please ?

Likes

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
Adobe Community Professional ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

Hi Michel,

 

I think what the OP wants to do is merge directly to PDF, so no post processing be done in this instance.

 

Rather than looking for a non-joiner, perhaps have the GREP look for a character that the user is unlikely to use in their general type such as | or © and then apply a "no fill or stroke" character style to that letter.

I've written about the "no fill or stroke" technique here: https://colecandoo.com/2012/08/08/no-fills-grep-styles-part-1/

 

What it means is that if the OP has the word paws for example, in their data merge file they would have to write |paws or ©paws for the GREP styles you've provided to be applied.

 

Likes

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 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

I'm okay with that.

Now I try to translate "

~j\K\w + color1
~j\w\K\w + color2

~j\w{2}\K\w + color3

~j\w{3}\K\w + color4

~j\w{4}\K\w + color5

"

into something usable in my case.

Likes

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, 2022 Jan 25, 2022

Copy link to clipboard

Copied

LATEST

So, now that I renamed all my |words like that, what I can do ?

Likes

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