With CS2 JS, I suppose that you need to call the <myTarget>.search(...) method without the replacingWith and withChangeAttributes properties. Try to let them undefined. The method returns the array of results (Text typed).
Since CS3 JS, you can use the specific <myTarget>.find<Text|Grep|Glyph>() method, rather than its change...() counterpart.
Thank you for the suggestions, but unfortunately those were the first things I tried. If you put in "undefined" for the replacingWith string, or if you just omit it entirely, it is as if you put in an empty string. All the matched sections in <myTarget> are removed.
And also unfortunately, my employer has yet to spring for CS3 or CS4.
[Sorry to proceed by trial and error, I don't have ID CS2 installed on my system...]
So, maybe you need to check or reset the app.changePreferences to NothingEnum.NOTHING :
app.changePreferences = NothingEnum.NOTHING;
var results = <myTarget>.search(<text>);
1 person found this helpful
Yes. You should set app.changePreferences = null;
Text.search (, false, false, undefined) should work fine.
Both of those last two answers were correct, thank you.
I wasn't realizing that the replacement string itself is one of the preferences that can remain behind from previous searches if you don't clear it.