bugFixRegression.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  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. // BEGIN PRELUDE
  6. function echo(o) {
  7. try {
  8. document.write(o + "<br/>");
  9. echo = function(o) { document.write(o + "<br/>"); };
  10. } catch (ex) {
  11. try {
  12. WScript.Echo("" + o);
  13. echo = function(o) { WScript.Echo("" + o); };
  14. } catch (ex2) {
  15. print("" + o);
  16. echo = function(o) { print("" + o); };
  17. }
  18. }
  19. }
  20. var suppressLastIndex = false;
  21. var suppressRegExp = false;
  22. var suppressIndex = false;
  23. function safeCall(f) {
  24. var args = [];
  25. for (var a = 1; a < arguments.length; ++a)
  26. args.push(arguments[a]);
  27. try {
  28. return f.apply(this, args);
  29. } catch (ex) {
  30. echo("EXCEPTION");
  31. }
  32. }
  33. hex = "0123456789abcdef";
  34. function dump(o) {
  35. var sb = [];
  36. if (o === null)
  37. sb.push("null");
  38. else if (o === undefined)
  39. sb.push("undefined");
  40. else if (o === true)
  41. sb.push("true");
  42. else if (o === false)
  43. sb.push("false");
  44. else if (typeof o === "number")
  45. sb.push(o.toString());
  46. else if (typeof o == "string") {
  47. if (o.length > 8192)
  48. sb.push("<long string>");
  49. else {
  50. sb.push("\"");
  51. var start = -1;
  52. for (var i = 0; i < o.length; i++) {
  53. var c = o.charCodeAt(i);
  54. if (c < 32 || c > 127 || c == '"'.charCodeAt(0) || c == '\\'.charCodeAt(0)) {
  55. if (start >= 0)
  56. sb.push(o.substring(start, i));
  57. start = -1;
  58. sb.push("\\u");
  59. sb.push(String.fromCharCode(hex.charCodeAt((c >> 12) & 0xf)));
  60. sb.push(String.fromCharCode(hex.charCodeAt((c >> 8) & 0xf)));
  61. sb.push(String.fromCharCode(hex.charCodeAt((c >> 4) & 0xf)));
  62. sb.push(String.fromCharCode(hex.charCodeAt((c >> 0) & 0xf)));
  63. }
  64. else {
  65. if (start < 0)
  66. start = i;
  67. }
  68. }
  69. if (start >= 0)
  70. sb.push(o.substring(start, o.length));
  71. sb.push("\"");
  72. }
  73. }
  74. else if (o instanceof RegExp) {
  75. var body = o.source;
  76. sb.push("/");
  77. var start = -1;
  78. for (var i = 0; i < body.length; i++) {
  79. var c = body.charCodeAt(i);
  80. if (c < 32 || c > 127) {
  81. if (start >= 0)
  82. sb.push(body.substring(start, i));
  83. start = -1;
  84. sb.push("\\u");
  85. sb.push(String.fromCharCode(hex.charCodeAt((c >> 12) & 0xf)));
  86. sb.push(String.fromCharCode(hex.charCodeAt((c >> 8) & 0xf)));
  87. sb.push(String.fromCharCode(hex.charCodeAt((c >> 4) & 0xf)));
  88. sb.push(String.fromCharCode(hex.charCodeAt((c >> 0) & 0xf)));
  89. }
  90. else {
  91. if (start < 0)
  92. start = i;
  93. }
  94. }
  95. if (start >= 0)
  96. sb.push(body.substring(start, body.length));
  97. sb.push("/");
  98. if (o.global)
  99. sb.push("g");
  100. if (o.ignoreCase)
  101. sb.push("i");
  102. if (o.multiline)
  103. sb.push("m");
  104. if (!suppressLastIndex && o.lastIndex !== undefined) {
  105. sb.push(" /*lastIndex=");
  106. sb.push(o.lastIndex);
  107. sb.push("*/ ");
  108. }
  109. }
  110. else if (o.length !== undefined) {
  111. sb.push("[");
  112. for (var i = 0; i < o.length; i++) {
  113. if (i > 0)
  114. sb.push(",");
  115. sb.push(dump(o[i]));
  116. }
  117. sb.push("]");
  118. if (!suppressIndex && (o.input !== undefined || o.index !== undefined))
  119. {
  120. sb.push(" /*input=");
  121. sb.push(dump(o.input));
  122. sb.push(", index=");
  123. sb.push(dump(o.index));
  124. // IE only
  125. // sb.push(", lastIndex=");
  126. // sb.push(dump(o.lastIndex));
  127. sb.push("*/ ");
  128. }
  129. }
  130. else if (o.toString !== undefined) {
  131. sb.push("<object with toString>");
  132. }
  133. else
  134. sb.push(o.toString());
  135. return sb.join("");
  136. }
  137. function pre(w, origargs, n) {
  138. var sb = [w];
  139. sb.push("(");
  140. for (var i = 0; i < n; i++) {
  141. if (i > 0) sb.push(", ");
  142. sb.push(dump(origargs[i]));
  143. }
  144. if (origargs.length > n) {
  145. sb.push(", ");
  146. sb.push(dump(origargs[n]));
  147. origargs[0].lastIndex = origargs[n];
  148. }
  149. sb.push(");");
  150. echo(sb.join(""));
  151. }
  152. function post(r) {
  153. if (!suppressLastIndex) {
  154. echo("r.lastIndex=" + dump(r.lastIndex));
  155. }
  156. if (!suppressRegExp) {
  157. // IE only
  158. // echo("RegExp.index=" + dump(RegExp.index));
  159. // echo("RegExp.lastIndex=" + dump(RegExp.lastIndex));
  160. var sb = [];
  161. sb.push("RegExp.${_,1,...,9}=[");
  162. sb.push(dump(RegExp.$_));
  163. for (var i = 1; i <= 9; i++) {
  164. sb.push(",");
  165. sb.push(dump(RegExp["$" + i]));
  166. }
  167. sb.push("]");
  168. echo(sb.join(""));
  169. }
  170. }
  171. function exec(r, s) {
  172. pre("exec", arguments, 2);
  173. echo(dump(r.exec(s)));
  174. post(r);
  175. }
  176. function test(r, s) {
  177. pre("test", arguments, 2);
  178. echo(dump(r.test(s)));
  179. post(r);
  180. }
  181. function replace(r, s, o) {
  182. pre("replace", arguments, 3);
  183. echo(dump(s.replace(r, o)));
  184. post(r);
  185. }
  186. function split(r, s) {
  187. pre("split", arguments, 2);
  188. echo(dump(s.split(r)));
  189. post(r);
  190. }
  191. function match(r, s) {
  192. pre("match", arguments, 2);
  193. echo(dump(s.match(r)));
  194. post(r);
  195. }
  196. function search(r, s) {
  197. pre("search", arguments, 2);
  198. echo(dump(s.search(r)));
  199. post(r);
  200. }
  201. function bogus(r, o) {
  202. echo("bogus(" + dump(r) + ", " + dump(o) + ");");
  203. try { new RegExp(r, o); echo("FAILED"); } catch (e) { echo("PASSED"); }
  204. }
  205. // END PRELUDE
  206. var r, s;
  207. // RegExp.$1-$9
  208. s = 'abc ';
  209. r = /(a)/g;
  210. exec(r, 'slkfg');
  211. echo("$1="+RegExp.$1);
  212. r = /(ab)/g;
  213. match(r, s);
  214. exec(r, 'slkfg');
  215. echo("$1="+RegExp.$1);
  216. r = /(abc)/g;
  217. exec(r, s);
  218. exec(r, 'slkfg');
  219. echo("$1="+RegExp.$1);
  220. r = /(abcd)/g;
  221. exec(r, s);
  222. exec(r, s);
  223. echo("$1="+RegExp.$1);
  224. r = /(abcde)/g;
  225. exec(r, 'slkfg');
  226. echo("$1="+RegExp.$1);
  227. r = /((abc)def)/g;
  228. replace(r, 'xyz abcdef abcdef xys', ".$1$2.");
  229. echo("$3="+RegExp.$3);
  230. echo("$2="+RegExp.$2);
  231. echo("$1="+RegExp.$1);
  232. exec(/q(a)*q/, "qaq");
  233. exec(/q(ab)*q/, "qababq");
  234. exec(/q(a|b)*q/, "xxqababqyy");
  235. exec(/q(a|bc)*q/, "xxqbcbdqbcbcqyy");
  236. exec(/q(?:a|(b))*q/, "xxqababqyy");
  237. exec(/q(?:a|(bc))*q/, "xxqbcbdqbcbcqyy");
  238. exec(/1{1,3}/, "1111");
  239. match(/1{1,4}/g, "1211111");
  240. exec(/a*$/, "b");
  241. exec(/a*/, "b");
  242. match(/a*/g, "b");
  243. replace(/(a?)b(\1){2,3}/g, "abaa b", "c");
  244. match(/(?:a?){1,2}/, "b");
  245. match(/(?:a?){1,3}/, "b");
  246. match(/(?:a?){2,3}/, "b");
  247. match(/(a?){1,2}/, "ab");
  248. match(/(a?){1,3}/, "ab");
  249. match(/(a?){2,3}/, "ab");
  250. match(/(?:(a)?){1,2}/, "ab");
  251. match(/(?:(a)?){1,3}/, "ab");
  252. match(/(?:(a)?){2,3}/, "ab");
  253. exec(/(?:(a)|b)+/, "ab");
  254. exec(/(?:(a)|d?)+/, "ab");
  255. exec(/(?:(a)|\1b)+/, "aab");
  256. exec(/(?:(a)|b\1){1,2}/, "aba");
  257. exec(/(?:a?)*b/, "a");
  258. exec(/(?:(?:a*)*)b/, "a");
  259. exec(/(?:(?:a*?)*)b/, "a");
  260. exec(/(^(?:.|\r|\n)*?):((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\3\))?(?![^\[]*\])(?![^\(]*\))/, ":contains('Google')");
  261. exec(/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w\-]+)$/, "#main");
  262. exec(/(?:a(?=b))*bc/, "aabc");
  263. exec(/(?:a(?=b))*/, "aabc");
  264. exec(/(?:a(?=aab))+/, "aaab");
  265. exec(/(?:a(?=b?|[^b]))*/, "aabc");
  266. exec(/(?:a(?=b*|[^b]))*/, "aabc");
  267. exec(/(?:a(?=b|[^b]))*/, "aabc");
  268. exec(/(?:[^?#](?![^?#\/]*\.[^?#\/.]+))*/, "a/a.a");
  269. exec(/^((((?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, "a/6237/8200/13977-9.js?cb=0.05630486307449717");
  270. r = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
  271. exec(r, "_http://optimized-by.rubiconproject.com/a/6237/8200/13977-9.js?cb=0.05630486307449717");
  272. exec(r, "engine_-and-_drivetrain/clutches-comma-_flywheels_-and-_components.html");
  273. exec(/()|/, "");
  274. exec(/a|()|/, "");
  275. exec(/(?:a|())a/, "a");
  276. r = /^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i;
  277. match(r, "#search-form");
  278. match(r, ".relevant");
  279. exec(/([A-Z]|[a-z]|[-_,'(){}/:\. ]|[0-9]|[^#$&%])+/, "Fbl_uex_cxe_dev4");
  280. match(/^\s*(\S+(\s+\S+)*)\s*$/, "Fbl_uex_cxe_dev4");
  281. replace(/^([ &-]|(of))*/i, " of london", "");
  282. replace(/^([ &-]|(of))*/i, "ofindcoolstuff.com", "");
  283. match(/(?:(?:kw|!c)=[^;]*;)+/, "kw=top;kw=home;kw=indexv2;!c=top;!c=home;!c=indexv2;sz=88x31;");
  284. exec(/(?:a|b)*(b+)/, "ababb");
  285. exec(/(?:a|b)*(a?)/, "ababa");
  286. exec(/(ab.*)*(.*)/, "ab");
  287. exec(/(?:(?:[^:]*):\/\/(?:[^:\/?]*)(?::(?:[0-9]+))?)?([^?#a]*|[^#]*)(?:[?](?:[^#]*))?(?:#(?:.*))?/, "http://shop.ebay.com/i.html?rt=nc&LH_FS=1&_nkw=dell+optiplex&_fln=1&_trksid=p3286.c0.m283");
  288. exec(/(?:(?:[^:]*):\/\/(?:[^:\/?]*)(?::(?:[0-9]+))?)?(([^?#a]*)|([^#]*))(?:[?](?:[^#]*))?(?:#(?:.*))?/, "http://shop.ebay.com/i.html?rt=nc&LH_FS=1&_nkw=dell+optiplex&_fln=1&_trksid=p3286.c0.m283");
  289. match(/\xz/, "xz");
  290. match(/\uz/, "uz");
  291. match(/[\xz]/g, "xz");
  292. match(/[\uz]/g, "uz");
  293. // JumpIfNotChar tests
  294. // TODO: update these tests and change to more meaningful ones if we optimize usage of JumpIfNotChar further
  295. exec(/a*b|c*/, "ac");
  296. exec(/a|b*|c|d/, "");
  297. exec(/a|b(?=e)|c*|d/, "b");
  298. exec(/a|b(?=e)|c*/, "b");
  299. exec(/a|b(?=e)|c*(?=f)|d/, "b");
  300. exec(/a|b(?=e)|c*(?=b)|d/, "b");
  301. exec(/a|b*(?=e)|c*|d/, "b");
  302. exec(/[^ ]+(?:\s*,\s*)?/g, "thead th");
  303. exec(/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g, "thead th");
  304. exec(/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, "form:not(#views-exposed-form-equipment-search-page-1) .views-exposed-widgets #edit-searchbox-wrapper input");
  305. r = /a*/g;
  306. s = "aa";
  307. exec(r, s);
  308. exec(r, s);
  309. exec(r, s);
  310. exec(r, s);
  311. r.lastIndex = 0;
  312. test(r, s);
  313. test(r, s);
  314. test(r, s);
  315. test(r, s);
  316. r.lastIndex = 0;
  317. match(r, s);
  318. exec(r, s);
  319. suppressLastIndex = true; // v8.exe bug: does not reset lastIndex
  320. replace(r, s, "bc");
  321. suppressLastIndex = false;
  322. echo('"".match()');
  323. var result = "".match();
  324. echo("result is array: " + (result instanceof Array));
  325. echo("result.length = " + result.length);
  326. echo("result[0] = " + (result[0] === "" ? '""' : result[0]));
  327. echo("result.input = " + (result.input === "" ? '""' : result.input));
  328. echo("result.index = " + result.index);
  329. safeCall(eval, "/(?:|)(?=a)/");
  330. safeCall(eval, "/(?:|)(?!a)/");
  331. safeCall(eval, "/[]|/;");
  332. match(/[]|[](?:)/, "");
  333. safeCall(eval, "/(?=[]ab|)/");
  334. safeCall(eval, "/(?:|(?=(?:(?:[]-a]||)))((R)+?))(?!(?:i))/");
  335. match(true ? /a/ : /a/, "a");
  336. match(false ? /a/ : /a/, "a");
  337. // The following are not necessarily related to one another
  338. match(/\d?/g, "");
  339. exec(/a?/, "ba");
  340. exec(/(a*|\*)([#.])([a]+)/, "#at16filt");
  341. exec(/((>>)a*|^a*($))/i, "buy>>");
  342. exec(/([^a]$)|(^a)/, "www.moviesunlimited.com");
  343. exec(/(a){0,2}(?:a?|b)/, "aaaa");
  344. replace(/([\s]|[^a]\+|^)([#])/g, "#sub #secondary #simple", "$1*$2");
  345. replace(/([\s]|[^a]+|^)([#])/g, "#sub #secondary #simple", "$1*$2");
  346. exec(/a?|b/, "b");
  347. split(/a|^/, "XaXaX");
  348. exec(/($)/, "abc");
  349. exec(/(\S)+/, "ab");
  350. exec(/(a)|.{0}/, "ax");
  351. exec(/\B/, "a ");
  352. exec(/((?:ex)$)|(^[0-9]$)/i, "ABCex");
  353. replace(/A(.)|B/, "B", "$1");
  354. match(/^a(b|c)?/, "abc");
  355. match(/(#)?([0-9a-f]*)/i, "#40000000");
  356. match(/(Stores)$|^a/, "4 Stores");
  357. match(/(z.|[^z])+/g, ".container");
  358. replace(/(get|query)(Element[s]?|Selector)?(By(Class|Tag|Id|Attr)|All)?(Name|ibute)?/, "getElementsByClassName", "$1$3");
  359. exec(/([\W]*)(\b\s*$)/, "The band's music and image (the two men perform in robot suits/helmets, for starters) has always had a noticable ");
  360. exec(/(?:)/, "");
  361. exec(/(c|(ab))*/, "cabcc");
  362. match(/(^|.*)ckeditor/i, "http://ckeditor");
  363. exec(/(?:a(?=b))?/, "ac");
  364. exec(/^(a\1?){4}$/, "aaaaaaaaaa");
  365. replace(/((a)\1{0})/, "aa", "b");
  366. exec(/([ab]|a\1)b/, "aab");
  367. exec(/\1((?=((?=\2))|G)\3)|(?!z{1,5}){4,}|(?=.+?)(P|L*)|(?!P|A)|\3|(?!")?|(?=(\5))/, "");
  368. exec(/((?=$)|(?!-))?/, "");
  369. match(/(\w+(\.|))+\./, "a.b");
  370. match(/(\w+(?:\.|))+\./, "a.b");
  371. match(/(i_event_domain=)(([a-z0-9]+(\.|))+\.[a-z]{2,3})/, "i_area_id=17&i_object_id=40394285&i_event_domain=port.hu&i_country_id=44");
  372. //This 'bug' was fixed as part of Unicode work. It is no longer allowed to have escape sequences as options in literal regex like this.
  373. //match(safeCall(eval, "/a$/\\u0067\\u0069\\u006D\n"), "A\nA");
  374. match(/(?:|a{0}b)?c/, "bc");
  375. // CompoundString with character appends after switching to pointer mode
  376. var str = "";
  377. for(var i = 0; i < 1024; ++i)
  378. str += "b";
  379. str = "<aaaaaaaaaaaaaaa>" + str;
  380. replace(/b/g, str, "$$");
  381. // Invalid regexes
  382. safeCall(eval, "/[z-a]/");
  383. // Optimization tests (need to be verified manually)
  384. exec(/a*(?:a?|b)/, "ababb"); // loop should be optimized since the loop's follow is irrefutable
  385. exec(/a*(?:a*|b)/, "ababb"); // loop should be optimized since the loop's follow is irrefutable
  386. exec(/a|b*|c|d/, ""); // should use JumpIfNotChar instead of TryIfChar for 'a' and 'c' since alternation's follow is irrefutable and first sets of alternatives are pairwise disjoint
  387. exec(/a|()/, "c"); // should not emit arm for last alternative since if it fails (although it doesn't) we need to fail the alternative, rather than assume empty was matched and try what's after the alternation
  388. // WOOB1135785
  389. var str = "";
  390. for (var i = 0; i < 500; i++)
  391. str += "a";
  392. exec(/(?!(.)+)/, str);
  393. // WOOB1137532
  394. exec(/a^|b/, "ab");
  395. // WOOB1138949
  396. var xx = String.fromCharCode("0x0080");
  397. var pattern = eval("/" + xx + "/");
  398. echo(dump(pattern.source));
  399. // WOOB1139118
  400. var r = /\b\w+\b/g;
  401. exec(r, "WT.z_acos");
  402. exec(r, "excamp");
  403. exec(r, "no_interstitial");
  404. // WOOB1139388
  405. exec(/\d(?=\d|.)/, "ab");
  406. // WOOB1139396
  407. exec(/\d{6}|\d|a/, "aaaa7a");
  408. exec(/(?:\$\s*)?(?:(?:\d{0,3}(?:[, ]\d{0,3})*[, ])+\d{3}|\d+)(?:\.\d*)?(?:\s*\$)?$/, "$100 is less than 200$");
  409. // WOOB1130814
  410. test(new RegExp("(?:r?)*?r|(.{2,4})", ""), "abcde");
  411. exec(/([^:]+?:)?([x]*)+/, "x");
  412. // OPEN:
  413. // "=XX====================================".match(/X(.+)+X/i);
  414. // /(...{2,})+\1\1/.exec("b aabbaabb a b aabab bab ab b a abb a a a aaaaabab aaba");
  415. // WOOB1140454
  416. suppressRegExp = true; // v8.exe updates RegExp, spec says otherwise
  417. split(/(?=^)/, "b");
  418. suppressRegExp = false;
  419. // WOOB1140741
  420. exec(/(baa){3,4}/, "baabbaabaabaabaabbaababbaaabaaaaab");
  421. // WOOB1140471
  422. exec(/b^|a/, "ba");
  423. // WOOB1139609
  424. search(/(a$)?/, "aa");
  425. // WOOB1099782
  426. exec(/(\3)(\1)(a)/, "cat");
  427. // WOOB1113286
  428. exec(/\1(?=ecma3)/i, "\001ECMA3");
  429. // WOOB1141367
  430. exec(/(?!^)b*c/, "bbc");
  431. // WOOB1143553
  432. replace(/^\s*|\s*$/g, " PH ", "");
  433. // WOOB1143779
  434. exec(/(a*)?/, "");
  435. exec(/(a+)?/, "");
  436. exec(/(?:a*)?/, "");
  437. exec(/(?:a+)?/, "");
  438. exec(/(?:a||b)?/, "b");
  439. // WOOB1145588
  440. exec(/[\s-a-c]*/, " -abc");
  441. exec(/[\s\-a-c]*/, " -abc");
  442. exec(/[a-\s-b]*/, " -ab");
  443. exec(/[a\-\s\-b]*/, " -ab");
  444. exec(/[\s--c-!]*/, " -./0Abc!");
  445. try {
  446. var r = new RegExp("[\\s-c-a]*", "");
  447. exec(r, " -abc");
  448. }
  449. catch (e) {
  450. echo("EXCEPTION");
  451. }
  452. // WOOB1145935
  453. exec(/x*(?:(?=x(y*)+)y|\1x)/, "xxy");
  454. // WOOB1146037
  455. test(/^\cA$/, "\x01");
  456. test(/^[\cA]$/, "\x01");
  457. // Disabled until we have a V8.exe which matches Chrome 10
  458. // However, added as known-value tests to unittest\Regex\regex1.js
  459. /*
  460. test(/^\c1$/, "\\c1");
  461. test(/^\c$/, "\\c");
  462. test(/\c/, "\\c");
  463. test(/^\c\1$/, "\\c\x01");
  464. test(/\c/, "\\c");
  465. test(/^[\c1]$/, "\x11");
  466. test(/^[\c]$/, "c");
  467. test(/^[\c]]$/, "c]");
  468. test(/^[\c-e]+$/, "cde");
  469. */
  470. // Windows 8 Bugs 385554
  471. test(/(?:|)x/, "x");
  472. test(/(?:ab|ac|)x/, "acx");
  473. test(/(?:ab|ac|)x/, "x");
  474. test(/(?:ab|bc|)x/, "bcx");
  475. test(/(?:ab|bc|)x/, "x");