Are you trying to find the brackts as well as text inside them? If so, you need to "escape" them becasue brackest are a special character in GREP. Your expression should be
Yes, I am and in the few times that it does seem to work it does get the brackets as well. Even if it didn't, I'd be happy to get consistency about when the entire operation works and doesn't. Right now, I don't have that basic thing figured out yet.
Thanks for responding.
To be certain, escaping the open/close bracket yields no different results than previous tests without escaping.
First off, I'm not sure what's failing in your expression, nor am I sure why it is picking up the brackets without escaping. One of the experts in GREP might know, but from what I can tell, it shouldn't since the brackets are used to define a class. Your expression will fail, for sure, if there is any white space at all inside the brackets, however, so that might be part of the problem.
If what's failing is that the GREP style is not changing text to which another character style is applied, I think that's expected behaior. Character styles override Paragraph styles, and the GREP style is part of the paragraph style. You should expect the GREP style to control only those attributes that are not controlled by the second applied character style, so if the GREP style says make the text bold and red, and the applied character style says make the text green and 20 pts, you shoud expect to see bold 20pt green text.
The following expression may be a bit cleaner and will pick up anything (shortest match) including white space that is surrounded by brackets and starts with two uppercase letters:
Thank you for replying. The supplied tightened pattern is appreciated as I am happy to learn more. My pattern still works fine, but the discussion of the character/paragraph style is on the right track.
It's helpful to understand that character styles are overrides as you say. So, testing this I set a test 'graf to "[None]" and made a new 'graf style with character traits as desired. Then I forced the test 'graf to this style. Then I applied your, and mine above for laughs, pattern in a GREP style within the 'graf style. That works.
I guess best practice is not to apply any character style to copy, but rather let the paragraph style define what the character style should control. If I have to apply a character style, it would seem to me that I may have to determine which would override if I'm going to apply it to a string that is covered by the GREP style within the ruling 'graf style. That is to say, would a character style manually applied after the fact to a string being ruled by a GREP style? I think I'm starting to see how the style sheets are interacting. Any other insight in how they play would be appreciated, sam
Rule of thumb for applying styles is basic formats for the entire paragraph should be defined in the paragraph style. If some selected bit of text needs to be formatted differnently, then you apply a character style (or, if you must, a local formatting override). With Nested Styles and GREP styles, ID has very powerful tools for applying character styles to selected text WITHIN the confines of the paragraph style definition. Most programs don't have that capability.
Should you apply the character syle as a nested or GREP style, or perhaps through Find/Change, or just by manually selecting text and applying the style? The answer to that will depend on a few variables. Should the particular string ALWAYS have a particular set of attributes, no matter what? Find/Change or local selection is the way to go. Character styles applied that way will survive even if the underlying paragraph style is changed to match the character style, then changed again. If the style should be applied to a string in a particular position in a paragraph, even if that position might move around a bit, a nested style is probably the way to go. If you want to make changes to text that matches a particular pattern, wherever it falls, when the surrounding text is a particular style, a GREP style is the answer.
GREP styles are very powerful, but they also use far more in terms of resources than applying a character style using other methods. I've seen reoprts of ID getting bogged down by too many GREP styles.