Copy link to clipboard
Copied
I have a document that has words in a different langauge and those words need to be in a different font. In the word document I've placed they are all in the different font, so when I placed it, I searched for the font and applied a character style to it. To my dismay, at the end of typesetting, I've realized that only a few letters per word have the character style appplied. I have no idea why, maybe something isn't right in the word document, but if possible, I don't want to have to re-place and re-typeset. Is there a way to search for a character style and then apply it to the entire word that it's found in?
You can do this in three step...
First is to mark the text with the character style you need to fix. Let’s call it [ChStyle].
Step 1: Use this to mark the text by adding a # and remove the style
Find: .+
Find Format: [ChStyle]
Change: #$0
Change format: [None]
Step 2: Apply the style to entire word
Find: [\l\u]*#[l\u]*
Change: $0
Change format: [ChStyle]
Step 3: Remove the #
Find: #
Find Format: [ChStyle]
Change: empty
Copy link to clipboard
Copied
You can do this in three step...
First is to mark the text with the character style you need to fix. Let’s call it [ChStyle].
Step 1: Use this to mark the text by adding a # and remove the style
Find: .+
Find Format: [ChStyle]
Change: #$0
Change format: [None]
Step 2: Apply the style to entire word
Find: [\l\u]*#[l\u]*
Change: $0
Change format: [ChStyle]
Step 3: Remove the #
Find: #
Find Format: [ChStyle]
Change: empty
Copy link to clipboard
Copied
Hi Jean-Claude, I think there is a typo in the Find expresssion in Step 2. It looks like it should be
[\l\u]*#[\l\u]*. Perhaps the lowercase l was converted to the numeral 1 accidentally by the forum platform.
Copy link to clipboard
Copied
It was a typo indeed. Edited.
Copy link to clipboard
Copied
Wouldn't it simply be faster/easier to use InDesign's Find/Change or the Find/Change By List script to search for each word and apply the appropriate character style?
Copy link to clipboard
Copied
Step 1:
Find: \w+
Find Format: [ChStyle]
Change: #$0
Step 2:
Find: (\w*)#(\w*)
Change: $1$2
Change format: [ChStyle]
Change \w by [\w-] if you want to target composed words!
Copy link to clipboard
Copied
Warning:
The guy who indicated here Jean-Claude Tremblay's answer as "correct" is surely someone without a great Grep knowledge!
This could obviously mislead this thread readers because my answer is correct too and technically a little more interesting. Not to mention the fact I only use 2 steps and not 3!
(^/) The Jedi