} else {
s = ToString(string);
}
- var length = s.length;
var lastIndex = this.lastIndex;
var global = this.global;
if (global) {
- if (i < 0 || i > length) {
+ if (i < 0 || i > s.length) {
this.lastIndex = 0;
return false;
}
if (!regexp_val.test(s)) return false;
}
- var length = s.length;
-
- if (i < 0 || i > length) {
- this.lastIndex = 0;
- return false;
- }
-
%_Log('regexp', 'regexp-exec,%0r,%1S,%2i', [this, s, lastIndex]);
// matchIndices is either null or the lastMatchInfo array.
var matchIndices = %_RegExpExec(this, s, i, lastMatchInfo);