I have a paragraph style with a GREP style inside that renders the first three words after the name (first paragraph) in small caps:
The “name” grep style also doesn't work btw, but let me focus on “small caps” for now. The thing is, the exact same Find/Change GREP query works just fine and returns exactly what I'm looking for. However, when in a style, it doesn't seem to work at all. Moreover, I went as far as creating a new document with a text frame with placeholder text and making a paragraph style with just the GREP and nothing else to make sure I'm not missing something the stacked up during the style build-up and it had no effect. Even tried it on different versions of InDesign.
What if you try \r~h\K instead of (?<=\r~h) ?
(for CS6 and later)
GREP styles cannot look "outside" of the single paragraph that they are defined "in". That means, in practice, you cannot use anything with "\r".
Use the common markers "^" and "$" for 'start of paragraph' and 'end of paragraph' instead. These do work in a GREP style because they do not explicitly test for presence of "\r" or its cousin "~h".
^^ Correct answer ^^
As far as I'm concerned anyway.