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.
^([^:\h]+\h?){1,3}(?=:)
(^/) The Jedi
Copy link to clipboard
Copied
Why don't you use a simple nested style?
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.
Copy link to clipboard
Copied
^([^:\h]+\h?){1,3}(?=:)
(^/) The Jedi
Copy link to clipboard
Copied
That worked perfectly! I'm not familiar with \h, what does that do?
Copy link to clipboard
Copied
\h means any space character, including tab for example.
Copy link to clipboard
Copied
\h stands for horizontal space.
Regards,
Uwe Laubender
( Adobe Community Expert )