Changing RegExp.input should not change RegExp.lastMatch, RegExp.$1, etc. In Safari 523.13: 'This seems like the right behavior'.match(/right/); RegExp.lastMatch; // == 'right' RegExp.input = 'Whereas this one is wrong, yo'; RegExp.lastMatch; // == 'wrong'
Created attachment 17989 [details] Test case MSIE 7 and Firefox 2.0.0.11 report "right" in both cases (as expected). Opera 9.24 reports "undefined" in both cases (apparently doesn't support these properties on their RegExp object). A local debug build of WebKit r28828 with Safari 3.0.4 (523.12) on Mac OS X 10.4.11 (8S165) reports "right" and "wrong".
Not a regression from Safari 2.0.4 as it reports "undefined" for both values.
Thanks for looking into this. It looks like all the deprecated properties of the RegExp constructor (lastMatch, leftContext, rightContext, lastParen, and $1 through $9) are computed lazily based on RegExp.input. However, RegExp.input is not necessarily the last matching subject string.
Looks like this is a very old bug; this works fine in ToT.