I've just tried findGrep() as well which is even more weird.
app.findGrepPreferences=app.changeGrepPreferences=null; app.findGrepPreferences.findWhat = "(?<!\\d\\.)\\d+(?!\\d?\\.)"; var sectionNumber = match.findGrep(),
If I alert section number it gives me an [object Character] or [object Word].
However if I access a property on it, it's undefined...
At this point match is an [object TextStyleRange]
I thought you were trying to use negative lookbehind/ahead in pure ExtendScript which I never get to work (is it an ExtendScript limitation ?) Let me rephrase, I mean using a regular expression on a pure string object.
Now I understand you want to do F/C through Scripting. Well, it seems like you have it all or close.
app.findGrepPreferences.findWhat = "(?<!\\d\\.)\\d+(?!\\d?\\.)";
should be ok for setting grep options.
Now finding text. You need to execute the findGrep on some text based object (or the doc or app objects). That could be a story, a paragraph, a word, etc.
var found = myStory.findGrep();
Which will return an array of results. Each array Item references the text object that matches the expression.
alert( found.contents ); //given that the result are not empty.
Thank you for the great answer!
I've finally got it working
It probably needs a polish but if your interested I can post it here?