I'm trying to us GREP in scripting to modify the style of some words designated with markup. For example: "The ^SUN^ and the ^MOON^ are celestial bodies."
app.FindGrepPreferences.FindWhat = "(\^.+?\^)"
I use this grep statemen to find "^SUN^" and "^MOON^", and I can change their characterstyle, but I also want to remove the "^" marks at the same time if possible.
Is there way to set an expression in my .toChange property so I can replace my selection with everything between the two "^" marks? That is, I want change "^XXX^" to become "XXX".
app.findGrepPreferences.FindWhat = "\^(.+?)\^"
app.changeGrepPreferences.changeTo = "$1"
Ah, I see! That makes sense! So the parentheses define what's returned by the $1 token. Very good. Thanks you!