I'm doing a full-text search of a Word document body where I perform several searches consecutively. They are all similar, but searching for slightly different patterns. The most complex of them throws a general exception at context.load(searchResults ...
I've isolated the problem using Script Lab to Character Group use (square brackets). If I use seven character groups, the search succeeds. If I add an eighth, a general exception is thrown. This is consistent even if I simplify everything else about the expression, as in this string that should find the word "Chapters".
If I scale back sSearchString to:
var sSearchString = '[Chapters][Chapters][Chapters][Chapters][Chapters][Chapters][Chapters]';
... it works and finds the word "Chapter" with no "s". But if I just add one more Character Group on the end:
var sSearchString = '[Chapters][Chapters][Chapters][Chapters][Chapters][Chapters][Chapters][Chapters]';
... it produces a general exception.
Is anyone familiar with this limitation of the MS JavaScript API? Does anyone have any suggestions for a workaround?