On Apr 13, 8:08 pm, Shankar Swamy <
shankar.sw...@gmail.com> wrote:
> var ExactPattern = "TITLE:\\s*" + myTitle;
> ExactPattern = myTmpString.match(ExactPattern);
The argument for .match(...) is supposed to be a regular expression.
Thus:
var pattern = "TITLE:\\s*" + myTitle;
var regexp = new RegExp(pattern);
var result = myTmpString.match(regexp);
It's possible that the browser's implementation of .match() allows for
passing a text string, which can then be converted to a RegExp object
internally. There may also be some static allocation of memory, as
some regexp implementations use globally-scoped 'state variables' to
track the 'parse position' in the text, so that iterative functions
can be applied to loop through all the matches.
I expect that the problem may be related to javascript-internal memory
allocation for locally vs. globally scoped variables. I note that
you've used the same variable name, ExactPattern, on both sides of the
assignment:
> ExactPattern = myTmpString.match(ExactPattern);
Potentially, this could trigger javascript to consume more memory when
the objects are pushed onto the 'call stack' during evaluation, or
when the resulting value is returned and then assigned.
In any case, I'm certain that regexp searches *can* operate on tiddler
content that is much larger than 12K, as I have several very large
plugins that are each >32K and they are searchable without problems.
Give my suggested code above a try and let me know if it makes any
difference.
-e