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

GREP issue: I want the last word in a paragraph to not hyphante, but it isn't

Community Expert ,
Oct 18, 2025 Oct 18, 2025

I followed the instructions here: what grep setting will let me not have a hyphanated word at the end of a paragraph in a paragraph st...

 

And it's not working. If I take the Character Style and apply it to the whole word, it's blocking the hyphen and moving the whole word to the last line (orphan) of the paragraph. I was assuming that the "\w+$" command would do that. But it's not. As the instructions (above) state, "This forces the entire last word to stay on one line, preventing it from being hyphenated. " What I'm thinking is that this is preventing the last word from hyphenating and is trying to keep it on the original line. There is no room for the entire word on that line, and it has to drop to the next line — which it's not letting happen.

 

At least that's how it seems. Am I right? If so, how can I get this to move the last word to the next line (and be an orphan)? [I cannot rewrite the text to make room for this orphan; I have to accept that. It's better than having the last line:

 

er.

 

Thanks!

TOPICS
How to
398
Translate
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 Expert , Oct 18, 2025 Oct 18, 2025

Hi @gary_sc 

I wonder why you don't simply untick this check box in the paragraph style option?

My screenshot is in French, but I am sure you'll understand where it is located.

Capture d’écran 2025-10-18 à 21.47.49.png

Translate
Community Expert ,
Oct 18, 2025 Oct 18, 2025

Hi @gary_sc 

I wonder why you don't simply untick this check box in the paragraph style option?

My screenshot is in French, but I am sure you'll understand where it is located.

Capture d’écran 2025-10-18 à 21.47.49.png

Translate
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 ,
Oct 18, 2025 Oct 18, 2025

HA!

 

Well, if I knew that, I would not have asked!

 

Big thanks!

Translate
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 ,
Oct 18, 2025 Oct 18, 2025

But, @jmlevy, this does beg the question, why didn't the GREP statement work?

 

Thanks!

Translate
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 ,
Oct 18, 2025 Oct 18, 2025

Yeah, this is definitely better than GREP.

Translate
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 ,
Oct 18, 2025 Oct 18, 2025

Is there any punctuation at the end of the paragraph? Your AI gnerated GREP does not mat a word followed by punctuation.

Try \w+\W*[[:punct:]]*\W*$ which should also pick up cases of trailing white space and footnote markers.

Translate
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 ,
Oct 18, 2025 Oct 18, 2025

Hi, @Peter Spier let me try that (at least for curiosity), thanks.

 

Alas, it did not work. But thank you VERY much for the suggestion.

 

And thanks again to @jmlevy for the simpler solution (that also works)

Translate
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 ,
Oct 18, 2025 Oct 18, 2025

It worked for me, so I'm surprised it didn't work for you, but As I pointed out in my previous post, your original expression has no option for anything other than a word character at the end of the paragraph, so is unlikely to match anything in normal text.

Translate
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 ,
Oct 18, 2025 Oct 18, 2025

Again, I really appreciate the effort. 

 

Unfortunately, I know more about the existence of GREP than I do about how to create proper expressions. Were it not for copy/paste, I'd not be using it at all.

 

Big thanks,

 

Gary

Translate
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 ,
Oct 18, 2025 Oct 18, 2025
LATEST

If you'd like to learn to write GREP expressions, I highly reccommend https://www.amazon.com/GREP-InDesign-InDesignSecrets-Peter-Kahrel/dp/0982508387

Translate
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