Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
try this grep
:\KFilename$
Copy link to clipboard
Copied
Hi!
(\H+):\K(?1)\b
(^/)
Copy link to clipboard
Copied
And another a bit different approach that seems working too:
:\K[^:]+?$
Copy link to clipboard
Copied
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."
(^/)
Copy link to clipboard
Copied
Sorry, it needs to target the last word of this style , basically after the last colon.
Copy link to clipboard
Copied
Whatever, Obi-wan. Seems like OP has a somewhat different problem since neither code works for him.
Copy link to clipboard
Copied
(^/)
Copy link to clipboard
Copied
The only problem is the text is dynamic. So it shouldn't look for a particular word.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
thanks so far
Copy link to clipboard
Copied
:\K\w+$
Copy link to clipboard
Copied
Thanks Vladan for swift response, but this does seem to work:
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Vladan,
Try: aaabbb_ccc.txt
(^/)
Copy link to clipboard
Copied
Maybe our friend has copied the \r at the end of our code!
It won't be the first time!
(^/)
Copy link to clipboard
Copied
in your character style did you choose bold?
Obi: well, we expect a more detailed question of lister110 in that sense
Copy link to clipboard
Copied
??
… Or:
(^/)
Copy link to clipboard
Copied
mmm, can't seem to get this to work in a paragraph style:
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
A variable! LOL!
(^/)
Copy link to clipboard
Copied
Thanks again. Maybe its harder to target a variable? Sorry for all the confusion..
Copy link to clipboard
Copied
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!
(^/)
Copy link to clipboard
Copied
No problem. Appreciate the help.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now