This content has been marked as final. Show 6 replies
Take a look at the pop-up menu associated with the Find What field in the Find/Change panel. At the bottom, you'll see the Modifiers submenu. On that submenu, you'll see the Case Insensitive On menu item. Choosing this enters (?i).
Righto, but my question applies to the scripting of the case-insensitive search.
in a jsx script, I have the following,
app.findGrepPreferences.findWhat = "fubar";
app.changeGrepPreferences.changeTo = "Snafu";
... in my document, I have "Fubar". My findWhat search string won't find it because of the case. How to take what I have above, in scripting, and set a case-insensitivity flag of some kind?
As Ole said,
>app.findGrepPreferences.findWhat = "(?i)fubar";
AH, ok. I tried the (?), but at the end of my needle. Thanks! Is there a list of all operators I can find somewhere in the documentation?
To the last post, then, I can simply use the GUI to build up a regexp if necessary (because the syntax does differ somewhat from traditional grep)
re: "To the last post, then, I can simply use the GUI to build up a regexp if necessary (because the syntax does differ somewhat from traditional grep)"
Yes, build the grep expression in the Find/Change panel, then, from the ESTK, send this:
//Clear findWhat to avoid false positives:
app.findGrepPreferences.findWhat = "";
//Where myString is the grep expression:
app.findGrepPreferences.findWhat = myString;
...then go back to InDesign and look at the Find What field in the Find/Change panel. Does it match the string you entered earlier? If so, you're good to go. If not, it's probably a matter of escaping some backslashes or quotes.
re: list of operators
As far as I know, the pop-up menus in the Find/Change panel constitiute the only list--but it's not comprehensive. Quite a bit of standard JS regular expressions work there, but are not available through pop-up menus.