Is this the first time that a $ appears? If so youcan use a second GREP style to apply [no style] to the $ and following.
1 person found this helpful
after the + in the expression you have. This is a negative lookahead -- the current character should not be followed by whatever is inside the parentheses (so this text will not be included in the expression).
In this you cannot use '$' because the dollar sign itself is a GREP code -- End Of Line --, and the regular escaping of special meanings -- precede it with a backslash -- is known to fail for the dollar sign. (But you can always test if (?!\$) works for you, as it's ever so slightly more obvious what you are doing .)
Thanks for the suggestions Jongware. I haven't got it working yet, but I'll persevere. Pasting in your addition to the expression doesn't seem to work, but it may be that I have to modify my original expression as well somehow.
Thanks Peter. If I try a second expression as you suggest, is it able to 'undo' what the first expression has already done. In that the first expression has already applied italics right through to the end of the description, so the second expression would have to override that?
I'll give it a go regardless and see what happens.
Running a second GREP style to pick up everything after the dollar sign worked a treat. Thank you!
1 person found this helpful
A-ha, I was thinking too simple. This turned out to be one of the more challenging ones
Your own expression appeared unnecessary complicated, by the way, because by default *all* GREP searches run to the end of a paragraph (which you here explicitly indicated using '\r'). However, I wondered what that '\n' was doing there in a group of its own. Apparently you may have insert any amount of soft line breaks, and it took me a while to find the cases where your GREP does not work without the explicit soft line break in the search but with a soft line break somewhere in the text:
This optional line break is a bother -- regular GREP sees it as the end of a paragraph, just like the hard return. (And you probably found that out the hard way as well.) A solution is to force GREP into Single Line Mode, where it ignores the special end-of-the-line meaning of both \n and \r and treats them as regular characters, so . will find them. But this adds a new problem: what about the \r at the very end? Fortunately because this is a GREP style you don't have to build in an extra check for the \r code -- GREP styles always stop at the end of a paragraph.
worked for me , that is, a sequence of characters where each single one is not followed by a '$' sign.
Very slick. You're still the master at this...
Cool, thank you Jongware, that is indeed very slick.
I suspected that it should be possible to get it working elegantly like this (no disrespect intended Peter), but it was beyond my abilities.
Thank you for sharing your knowledge.
I don't feel offended or disrespected in the least. Jongware is the man for this stuff.