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

Apply a grep style to bold the last word after the colon

Participant ,
Sep 13, 2017 Sep 13, 2017

Example:

Filename and path: Macintosh HD:Users:rob.freeman:Desktop:Filename

--------

Hi, I would like to apply a bold style to the last word of the string above. 'Filename' with a grep style. I have found a grep style here:

^[^:]+:

But this adds the bold at the beginning. How do I get this to be like this:

Filename and path: Macintosh HD:Users:rob.freeman:Desktop:Filename

lister

2.8K
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 13, 2017 Sep 13, 2017

try this grep

:\KFilename$

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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

Hi!

(\H+):\K(?1)\b

(^/) 

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
Mentor ,
Sep 13, 2017 Sep 13, 2017

And another a bit different approach that seems working too:

:\K[^:]+?$

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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

winterm,

Yeap if you target simple paras!

Nope if this sentence is included into a para as:

"xxxx xxxx (filename and path: Macintosh HD:Users:rob.freeman:Desktop:Filename.psd) xxxx xxxx."

(^/) 

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
Participant ,
Sep 13, 2017 Sep 13, 2017

Sorry, it needs to target the last word of this style , basically after the last 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
Mentor ,
Sep 13, 2017 Sep 13, 2017

Whatever, Obi-wan. Seems like OP has a somewhat different problem since neither code works for him.

Last.gif

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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

(^/)

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
Participant ,
Sep 13, 2017 Sep 13, 2017

The only problem is the text is dynamic. So it shouldn't look for a particular word.

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 13, 2017 Sep 13, 2017

well, I didn't understand good your question

I thought the word is always the filename

is always better to make a precise question for a precise answer

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
Participant ,
Sep 13, 2017 Sep 13, 2017

Hi Vladan, sorry to confuse you.

Hi Obi, this doesn't seem to work:

(\H+):\K(?1)\b

and the code here

:\K[^:]+?$

adds the bold style to everything after the first ':'

Filename and path: Macintosh HD:Users:rob.freeman:Desktop:Filename

Screen Shot 2017-09-13 at 10.22.44.png

thanks so far

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 13, 2017 Sep 13, 2017

:\K\w+$

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
Participant ,
Sep 13, 2017 Sep 13, 2017

Thanks Vladan for swift response, but this does seem to work:

Screen Shot 2017-09-13 at 10.34.36.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
Guide ,
Sep 13, 2017 Sep 13, 2017

Schermata 2017-09-13 alle 11.38.51.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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

Vladan,

Try:  aaabbb_ccc.txt

(^/)

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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

Maybe our friend has copied the \r at the end of our code!

It won't be the first time! 

(^/)

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 13, 2017 Sep 13, 2017

in your character style did you choose bold?

Schermata 2017-09-13 alle 11.41.51.png

Obi: well, we expect a more detailed question of lister110 in that sense

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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

?? 

Capture d’écran 2017-09-13 à 11.36.21.png

… Or:

Capture d’écran 2017-09-13 à 11.39.10.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
Participant ,
Sep 13, 2017 Sep 13, 2017

mmm, can't seem to get this to work in a paragraph style:

Screen Shot 2017-09-13 at 10.42.11.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
Participant ,
Sep 13, 2017 Sep 13, 2017

I think the problem is I am using a variable as the path and file name.

Vladan you grep works but not on the dynamic part of the text. Can grep work on variable text?

thanks everyone for your input.. really appreciate it.

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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

A variable!  LOL!

(^/)

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
Participant ,
Sep 13, 2017 Sep 13, 2017

Thanks again. Maybe its harder to target a variable? Sorry for all the confusion..

Screen Shot 2017-09-13 at 10.56.34.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
LEGEND ,
Sep 13, 2017 Sep 13, 2017

In this video, I've manipulated the variables by script!

InDesign: TOC, Caption & Variable! … - YouTube

In your case, it's easy [and I'll use my grep code] to manipulate them to have the result you want without loosing the dynamic link!

The bad news: I don't write script for free! 

(^/)

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
Participant ,
Sep 13, 2017 Sep 13, 2017
LATEST

No problem. Appreciate the help.

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