Reply To: GREP: finding double hyphenated words

Home Page / Forums / General InDesign Topics (CLOSED) / GREP: finding double hyphenated words / Reply To: GREP: finding double hyphenated words

#53925

You cannot search the hyphen InDesign adds itself. I would suggest a tiny javascript instead. (Beware! Untested! Your Computer May Explode (etc.))

app.findGrepPreferences = null;

app.findGrepPreferences.findWhat = “bw+-w+b”;

result = app.activeDocument.findGrep();

if (result.length == 0)

alert (“No More! No More!”);

else

result[0].select();

Then fix them yourself.

—-< Afterthought, 2 seconds later >—

Ahhhh — perhaps it's easier to apply No Break to the individual parts of the word (but not the hyphen!). You would need two GREP styles for that, one for each half:

<w+(?=-w)

and

(?<=w-)w+>

— both should apply a character style containing No Break. You might want to consider checking a maximum length of the word parts. There are not that many ten-letter-each compound words, but surely you would consider hyphenating “representative-elect”, “three-dimensionalness” or “vice-chancellorship”? (14 letters and more before or after the hyphen; just a few random finds in my English word list)

This article was last modified on November 23, 2009

Comments (0)

Loading comments...