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

Another grep request, much appreciated

New Here ,
Sep 03, 2025 Sep 03, 2025

Hello all.

I can find grep commands that do some of these things, but I need one that does all of them. For some wild reason, after spending hours online, I cannot find the solution. I appreciate your help. No, nested styles do not help here. I need a command in my paragraph style that does this:

- applies a character style up to AND INCLUDING a colon, ONLY if there's a colon in the paragraph.

- Ideally this goes up to just the first colon. If that's not possible, I need to set a word limit (let's say 10 words for example) on how far the search goes into the paragraph.

Thank you.

TOPICS
Scripting
288
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

Guide , Sep 03, 2025 Sep 03, 2025

Words Limit = 10! So:

^(\H+\h){0,9}?\H+:

 

Words Limit = 4! So:

^(\H+\h){0,3}?\H+:

 

(^/)

Translate
Community Expert ,
Sep 03, 2025 Sep 03, 2025

Hi @Beemo8bit, add a Grep style with this pattern:

^[^:]+:

 

It means: 

^        match start of text

[^:]+  match one or more characters that aren't colon

:         match one colon

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
Guide ,
Sep 03, 2025 Sep 03, 2025

^.+?:

 

(^/) The Jedi

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
New Here ,
Sep 03, 2025 Sep 03, 2025

Thanks, but this doesn't have the word limit option that I really need too.

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
Guide ,
Sep 03, 2025 Sep 03, 2025

Words Limit = 10! So:

^(\H+\h){0,9}?\H+:

 

Words Limit = 4! So:

^(\H+\h){0,3}?\H+:

 

(^/)

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
New Here ,
Sep 03, 2025 Sep 03, 2025
LATEST

You have saved my sanity!!!!!

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 ,
Sep 03, 2025 Sep 03, 2025

Couldn't nested styles do this too?

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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 ,
Sep 03, 2025 Sep 03, 2025
quote

Couldn't nested styles do this too?

 


By @Dave Creamer of IDEAS

I think the requirement for no match if there's no colon rules out a nested style as it would end up matching the entire paragraph.

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
New Here ,
Sep 03, 2025 Sep 03, 2025

Correct, I tried this already. If Adobe could add a nested style option for 'after' as well as 'before' or 'through', that would be a game changer! A feature I see that requested many years ago already....

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 ,
Sep 03, 2025 Sep 03, 2025

Ah, missed that part...

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
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