Do you mean you want to underline the 12th "and" in the document?
Doesn't sound like it. Please clarify what you want.
Thanks for your reply.
Thats exactly what I want to do: is it possible to target / mark only word number 12 using GREP?
Edit: If it is not possible to search via a index (12th word), perhaps the way to go would be to somehow include the word that follows the "and" I want into the seach: but without marking it?
This is what you are looking for
var doc = app.documents, myAnds; app.findTextPreferences = app.changeTextPreferences = null; app.changeGrepPreferences = app.findGrepPreferences = null; app.findChangeTextOptions.caseSensitive = 0; app.findChangeTextOptions.wholeWord = 1; app.findTextPreferences.findWhat = "and"; myAnds = doc.findText (); myAnds.fillColor = "C=15 M=100 Y=100 K=0"; // To make the 12th and red
I used text instead of Greps but you could use the grep findWhat "\\<[Aa]nd\\>" which is more accurate.
Perfect, thanks a lot!