Copy link to clipboard
Copied
Dear InDesign community,
300 pages have been copied into InDesign. Unfortunately, underline within words has been removed. Is there a simple way for the word "Shah" to be replaced with "Shah" and not every "Sh" word being underlined?
There are many other "Sh" words that do require underline to, such as "Shaykh" and "Shahíd" and "Báshí", so due to this complexity, "Change All" is not likely an option, but even one at a time with "Find/Change" would be better than copying and applying 300p of styles to paragraphs.
Thank you in advance.
Copy link to clipboard
Copied
Created a Character Style called "underline" that just underlines text.
Created a Paragraph Style called "body" that is applied to all of the text.
Within the body Paragraph Style created a GREP Style which applied the underline Character Style whenever it identified "Sh(?=ah )" where...
Sh
Represents the characters "Sh"
(?=ah )
Looks for the presence of the characters "ah " directly after the originally detected characters "Sh". This takes advantage of a feature called a Positive Lookahead.
One of the best parts of this method is that it is dynamic. Any text that you add that has the body Paragraph Style applied to it will automatically underline the first two letters of the word Shah.
If you are liking what this can do but have no idea what GREP is, feel free to ask away. We love GREP in this forum 😉
Copy link to clipboard
Copied
Michael beat me to it :), but i have a slightly different variation
Sh(?=ah\b)
To cater to cases where the word is separated by something other than a space character. \b here defines the word boundary and is a zero length match. Rest all is explained brilliantly by Michael.
-Manan
Copy link to clipboard
Copied
Good call Manan.
Copy link to clipboard
Copied
To make is more robust i think we need to add \b at the start also, to avoid matching words that end in Shah, highly improbable but good to plug all gaps so that any other solution based on this should take care of this as well. So the final expression should be
\bSh(?=ah\b)
-Manan
Copy link to clipboard
Copied
Thank you,
I'm not savvy with GREP yet. If there are multiple words can they somehow be OR'd together, such as:
\bSh(?=áh\b) OR \bSh(áhs\b) OR \bsh(í’ah\b) OR \bSh(í’ah\b) OR \bsh(í’ahs) OR \bSh(í’ahs) OR \b(farrá)sh\b OR \b(Farrá)sh\b OR \bsh(aykh\b) OR \bSh(aykh\b) OR \bsh(áhinsháh\b) OR \bSh(áhinsháh)\b OR \b(Ma)sh(had\b) OR \bSh(ahribánú\b) ... for all "Sh" words requiring underline
Copy link to clipboard
Copied
If you have a finite list of words that are to be underlined, it might be simplest to identify them individually within the GREP Style.
Let's say you had the following situation…
Words to be underlined: Shah and Shadow
The text: Shah Shell Sham Shallow Shake Shadow
EXAMPLE 1
This example has a GREP Style entry for each word. This method allows for different Character Styles to be applied to different words.
EXAMPLE 2
This example has a single GREP Style and uses the "|" character (just above the Enter key) as an OR symbol.
Copy link to clipboard
Copied
Try something like
\bSh(?=ah|am|adow\b)
Where you can add each variation of characters that can come after Sh by adding a | character followed by the character sequence. See a sample below
-Manan