I've been fighting with InDesign GREP find/change quite a bit and couldn't find any way to get it to look at the start and the end of a character style. This is necessary if, for example, you want to grab only whole chunks of a character style and only if they don't contain something.
For example, you might have text like...
Lorem ipsum dolor sit2-4 amet, consectetur5 adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud2,3 exercitation ullamco6 laboris nisi ut aliquip ex ea commodo consequat.
...and you want to make GREP rules that strictly start only from the start of each snippet or span of the character style applying the superscript, and strictly end only at the end of the character style applying the superscript.
(for example, so you can find whole snippets that don't contain punctuation like "-" or ",", without finding sub-snippets that aren't punctuation such as the 2 in "2,3")
Using ^
and $
(beginning and end of paragraph/line) with a character style specified in Find/Change gives weird results and then crashes. Using word boundaries \b
and the mysterious "opposite of a word boundary" \B
also gave strange results (jumping the cursor to the right place once, then not selecting anything and not finding any more locations).