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

GREP Style, for limited amount of words and symbols before a colon

Community Beginner ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

Hello,

Anytime I have a colon at the start of a paragraph, I would like the words and symbols up to and including the colon bold and underlined. I have been using this which I found in another forum: 

^(((?!:)\w)+.?+\s?){1,3}?:

 

An Example: Looks like this every time up to 3 words. Exactly what I need.

But This (BT): Does not change to my bold/underline style, even if I increase the range from {1,3} to {1,10}

+1 Not Working: It also fails to work with other symbols. 

 

Something like this might work: ^.*?(?=:)

However, I have a few instances of a colon at the end of a long sentence, and don't want the bold/underline style applied then. I'm relatively new to GREP and while I'm starting to grasp it, some things still escape me entirely. Any suggestions would be greatly appreciated.

 

TOPICS
How to , Scripting

Views

798

Translate

Translate

Report

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 , Jan 20, 2023 Jan 20, 2023

^([^:\h]+\h?){1,3}(?=:)

 

(^/)  The Jedi

Votes

Translate

Translate
Community Expert ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

Why don't you use a simple nested style?

Capture d’écran 2023-01-20 à 23.15.57.png

Votes

Translate

Translate

Report

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 Beginner ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

Thanks for the suggestion but that applies it to everything except the words in the sentence that immediately follow the colon. I don't believe a nested style will work the same way a GREP style can, since a GREP can be much more targeted to a specific instance.

Votes

Translate

Translate

Report

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 ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

^([^:\h]+\h?){1,3}(?=:)

 

(^/)  The Jedi

Votes

Translate

Translate

Report

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 Beginner ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

That worked perfectly! I'm not familiar with \h, what does that do?

 

Votes

Translate

Translate

Report

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 ,
Jan 20, 2023 Jan 20, 2023

Copy link to clipboard

Copied

\h means any space character, including tab for example.

Votes

Translate

Translate

Report

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 ,
Jan 23, 2023 Jan 23, 2023

Copy link to clipboard

Copied

LATEST

\h stands for horizontal space.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Votes

Translate

Translate

Report

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