Skip to main content
Legend
August 27, 2025
Question

detect grep style runs

  • August 27, 2025
  • 1 reply
  • 254 views

Hi,

 
Grep styles. I would like to detect if a text range has been affected by a grep style. I can detect if the para has grep styles, I am interested in just the text range / run.
 
I have looked at:

ICompositionStyle

composeScanner->QueryAttributeAt with kTextAttrGrepStylesBoss

 

These seem to only return paragraph level info.

 

Thanks.

 

P.

 

1 reply

Community Expert
August 27, 2025

Hi @Pickory ,

I think this is complicated matter, because, in the end, it's a text composition result, a "phenotype" result out of GREP Style "genes", if you wish. So you could add "marker formatting" like applied color* to the GREP Styles and "see" what the composition engine will do. Sometimes you have to outline a text duplicate to get a clear results in case of applied marker colors.

 

* other formatting that is not that obviously visible could perhaps work better.

 

I don't think that text style ranges are the solution.

 

PS: A couple of years ago we had a discussion on "circular" applied GREP Styles to color individual characters. Turned out in one case that the visible color of one of the characters did not match the color the Swatches panel was showing when the character was selected. So prepare for strange cases…

 

Regards,
Uwe Laubender
( Adobe Community Expert )

PickoryAuthor
Legend
August 28, 2025

Hi Uwe,

Thank you for your reply.

I hadn't noticed this before. The applied grep character style is not selected in the character style palette when the text with the character style is selected. see pics.

==================

Community Expert
August 28, 2025

Hi Pickory,

the character style applied through the GREP Style is not selected, true; but it is visible at the bottom of the character styles panel.

 

Your sample is the easiest one.

You may run into more complex scenarios where more than one GREP Style is defined in the applied paragraph style or in the applied paragraph formatting that overlaps or overrides a given style. Or if other formatting is applied…

 

Regards,
Uwe Laubender
( Adobe Community Expert )