Skip to main content
Open

How to use a character style in a positive lookbehind

  • June 27, 2025
  • 2 replies
  • 16 views

Hello All,

I have a large document with hundreds of short phrases in an italic Character Style followed immediately by a comma with [No Style]. I want to apply the same italic Character Style to the trailing comma. That is, I want to change [italic-phrase], to [italic-phrase,].

 

I don't see any way to do this with the Find/Change GREP dialog, but maybe in ExtendScript? It sounds like a job for GREP with a positive lookbehind, but I'm not sure how to accomplish this in Extendscript.

 

Is there an existing script that might be adapted to such a use case? Or can someone show how to find a comma preceded by italic styled text? Or any better idea?

 

2 replies

Forum|alt.badge.img

Ah! figured it out! If you have a frame around it -- rather a frame on TOP of it, the link won't work. So I pushed the frames to the back. It works!  So am happy with it now, and especially how it looks on tablet. But it's a bit wonky on the phone. kind of floats all over the place.


  • June 27, 2025

No problem, glad it helped, there's always different approaches, if you have long documents then Mark's is probably faster. 

 

You can mark as many as you like as correct answer, there can always be more than 1, I went ahead and marked Mark's as correct too.