stackregex_box.js 694 B

1234567891011121314151617181920212223242526272829
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function test()
  6. {
  7. var r = /a/;
  8. var r2 = r;
  9. var str = "a";
  10. WScript.Echo(r.exec(str));
  11. WScript.Echo(r === r2);
  12. }
  13. test();
  14. test();
  15. var g;
  16. var oldExec = RegExp.prototype.exec;
  17. RegExp.prototype.exec = function(str)
  18. {
  19. g = this;
  20. }
  21. test();
  22. WScript.Echo(oldExec.call(g, "a"));