This code can be used for testing in IE8 / firefox with firebug / Chrome.
var regex = "";
var maximum = 100;
var showAfter = 95;
for(i = 1; i < maximum; i++) {
regex += "aaaaaaaaaa";
if (i > showAfter) {
console.log(10 * i + " chars");
console.log(RegExp(regex));
}
}
When you receive an error message, you have found a restriction.
SIMPLE TEST
var regex = "";
var chars = 3204161;
for(i = 0; i < chars; i++) {
regex += "a";
}
alert(chars + " chars");
var a = RegExp(regex);
results
In Firefox 3.6.3 (Ubuntu 32 bits) I get an error when I tried a regex with 9M characters (9.999.990 characters) 3.204.161 . With 3.204.160 this is normal.
Chrome 5.0.3 - - 20M 25M.
firefox:
script stack space quota is exhausted
. - , .