1 // Copyright 2013 the V8 project authors. All rights reserved. 2 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions 6 // are met: 7 // 1. Redistributions of source code must retain the above copyright 8 // notice, this list of conditions and the following disclaimer. 9 // 2. Redistributions in binary form must reproduce the above copyright 10 // notice, this list of conditions and the following disclaimer in the 11 // documentation and/or other materials provided with the distribution. 12 // 13 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 24 description( 25 "A chunk of our port of PCRE's test suite, adapted to be more applicable to JavaScript." 26 ); 27 28 var regex0 = /a.b/; 29 var input0 = "acb"; 30 var results = ["acb"]; 31 shouldBe('regex0.exec(input0);', 'results'); 32 var input1 = "a\x7fb"; 33 var results = ["a\u007fb"]; 34 shouldBe('regex0.exec(input1);', 'results'); 35 var input2 = "a\u0100b"; 36 var results = ["a\u0100b"]; 37 shouldBe('regex0.exec(input2);', 'results'); 38 // Failers 39 var input3 = "a\nb"; 40 var results = null; 41 shouldBe('regex0.exec(input3);', 'results'); 42 43 var regex1 = /a(.{3})b/; 44 var input0 = "a\u4000xyb"; 45 var results = ["a\u4000xyb", "\u4000xy"]; 46 shouldBe('regex1.exec(input0);', 'results'); 47 var input1 = "a\u4000\x7fyb"; 48 var results = ["a\u4000\u007fyb", "\u4000\u007fy"]; 49 shouldBe('regex1.exec(input1);', 'results'); 50 var input2 = "a\u4000\u0100yb"; 51 var results = ["a\u4000\u0100yb", "\u4000\u0100y"]; 52 shouldBe('regex1.exec(input2);', 'results'); 53 // Failers 54 var input3 = "a\u4000b"; 55 var results = null; 56 shouldBe('regex1.exec(input3);', 'results'); 57 var input4 = "ac\ncb"; 58 var results = null; 59 shouldBe('regex1.exec(input4);', 'results'); 60 61 var regex2 = /a(.*?)(.)/; 62 var input0 = "a\xc0\x88b"; 63 var results = ["a\xc0", "", "\xc0"]; 64 shouldBe('regex2.exec(input0);', 'results'); 65 66 var regex3 = /a(.*?)(.)/; 67 var input0 = "a\u0100b"; 68 var results = ["a\u0100", "", "\u0100"]; 69 shouldBe('regex3.exec(input0);', 'results'); 70 71 var regex4 = /a(.*)(.)/; 72 var input0 = "a\xc0\x88b"; 73 var results = ["a\xc0\x88b", "\xc0\x88", "b"]; 74 shouldBe('regex4.exec(input0);', 'results'); 75 76 var regex5 = /a(.*)(.)/; 77 var input0 = "a\u0100b"; 78 var results = ["a\u0100b", "\u0100", "b"]; 79 shouldBe('regex5.exec(input0);', 'results'); 80 81 var regex6 = /a(.)(.)/; 82 var input0 = "a\xc0\x92bcd"; 83 var results = ["a\xc0\x92", "\xc0", "\x92"]; 84 shouldBe('regex6.exec(input0);', 'results'); 85 86 var regex7 = /a(.)(.)/; 87 var input0 = "a\u0240bcd"; 88 var results = ["a\u0240b", "\u0240", "b"]; 89 shouldBe('regex7.exec(input0);', 'results'); 90 91 var regex8 = /a(.?)(.)/; 92 var input0 = "a\xc0\x92bcd"; 93 var results = ["a\xc0\x92", "\xc0", "\x92"]; 94 shouldBe('regex8.exec(input0);', 'results'); 95 96 var regex9 = /a(.?)(.)/; 97 var input0 = "a\u0240bcd"; 98 var results = ["a\u0240b", "\u0240", "b"]; 99 shouldBe('regex9.exec(input0);', 'results'); 100 101 var regex10 = /a(.??)(.)/; 102 var input0 = "a\xc0\x92bcd"; 103 var results = ["a\xc0", "", "\xc0"]; 104 shouldBe('regex10.exec(input0);', 'results'); 105 106 var regex11 = /a(.??)(.)/; 107 var input0 = "a\u0240bcd"; 108 var results = ["a\u0240", "", "\u0240"]; 109 shouldBe('regex11.exec(input0);', 'results'); 110 111 var regex12 = /a(.{3})b/; 112 var input0 = "a\u1234xyb"; 113 var results = ["a\u1234xyb", "\u1234xy"]; 114 shouldBe('regex12.exec(input0);', 'results'); 115 var input1 = "a\u1234\u4321yb"; 116 var results = ["a\u1234\u4321yb", "\u1234\u4321y"]; 117 shouldBe('regex12.exec(input1);', 'results'); 118 var input2 = "a\u1234\u4321\u3412b"; 119 var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; 120 shouldBe('regex12.exec(input2);', 'results'); 121 // Failers 122 var input3 = "a\u1234b"; 123 var results = null; 124 shouldBe('regex12.exec(input3);', 'results'); 125 var input4 = "ac\ncb"; 126 var results = null; 127 shouldBe('regex12.exec(input4);', 'results'); 128 129 var regex13 = /a(.{3,})b/; 130 var input0 = "a\u1234xyb"; 131 var results = ["a\u1234xyb", "\u1234xy"]; 132 shouldBe('regex13.exec(input0);', 'results'); 133 var input1 = "a\u1234\u4321yb"; 134 var results = ["a\u1234\u4321yb", "\u1234\u4321y"]; 135 shouldBe('regex13.exec(input1);', 'results'); 136 var input2 = "a\u1234\u4321\u3412b"; 137 var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; 138 shouldBe('regex13.exec(input2);', 'results'); 139 var input3 = "axxxxbcdefghijb"; 140 var results = ["axxxxbcdefghijb", "xxxxbcdefghij"]; 141 shouldBe('regex13.exec(input3);', 'results'); 142 var input4 = "a\u1234\u4321\u3412\u3421b"; 143 var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; 144 shouldBe('regex13.exec(input4);', 'results'); 145 // Failers 146 var input5 = "a\u1234b"; 147 var results = null; 148 shouldBe('regex13.exec(input5);', 'results'); 149 150 var regex14 = /a(.{3,}?)b/; 151 var input0 = "a\u1234xyb"; 152 var results = ["a\u1234xyb", "\u1234xy"]; 153 shouldBe('regex14.exec(input0);', 'results'); 154 var input1 = "a\u1234\u4321yb"; 155 var results = ["a\u1234\u4321yb", "\u1234\u4321y"]; 156 shouldBe('regex14.exec(input1);', 'results'); 157 var input2 = "a\u1234\u4321\u3412b"; 158 var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; 159 shouldBe('regex14.exec(input2);', 'results'); 160 var input3 = "axxxxbcdefghijb"; 161 var results = ["axxxxb", "xxxx"]; 162 shouldBe('regex14.exec(input3);', 'results'); 163 var input4 = "a\u1234\u4321\u3412\u3421b"; 164 var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; 165 shouldBe('regex14.exec(input4);', 'results'); 166 // Failers 167 var input5 = "a\u1234b"; 168 var results = null; 169 shouldBe('regex14.exec(input5);', 'results'); 170 171 var regex15 = /a(.{3,5})b/; 172 var input0 = "a\u1234xyb"; 173 var results = ["a\u1234xyb", "\u1234xy"]; 174 shouldBe('regex15.exec(input0);', 'results'); 175 var input1 = "a\u1234\u4321yb"; 176 var results = ["a\u1234\u4321yb", "\u1234\u4321y"]; 177 shouldBe('regex15.exec(input1);', 'results'); 178 var input2 = "a\u1234\u4321\u3412b"; 179 var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; 180 shouldBe('regex15.exec(input2);', 'results'); 181 var input3 = "axxxxbcdefghijb"; 182 var results = ["axxxxb", "xxxx"]; 183 shouldBe('regex15.exec(input3);', 'results'); 184 var input4 = "a\u1234\u4321\u3412\u3421b"; 185 var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; 186 shouldBe('regex15.exec(input4);', 'results'); 187 var input5 = "axbxxbcdefghijb"; 188 var results = ["axbxxb", "xbxx"]; 189 shouldBe('regex15.exec(input5);', 'results'); 190 var input6 = "axxxxxbcdefghijb"; 191 var results = ["axxxxxb", "xxxxx"]; 192 shouldBe('regex15.exec(input6);', 'results'); 193 // Failers 194 var input7 = "a\u1234b"; 195 var results = null; 196 shouldBe('regex15.exec(input7);', 'results'); 197 var input8 = "axxxxxxbcdefghijb"; 198 var results = null; 199 shouldBe('regex15.exec(input8);', 'results'); 200 201 var regex16 = /a(.{3,5}?)b/; 202 var input0 = "a\u1234xyb"; 203 var results = ["a\u1234xyb", "\u1234xy"]; 204 shouldBe('regex16.exec(input0);', 'results'); 205 var input1 = "a\u1234\u4321yb"; 206 var results = ["a\u1234\u4321yb", "\u1234\u4321y"]; 207 shouldBe('regex16.exec(input1);', 'results'); 208 var input2 = "a\u1234\u4321\u3412b"; 209 var results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; 210 shouldBe('regex16.exec(input2);', 'results'); 211 var input3 = "axxxxbcdefghijb"; 212 var results = ["axxxxb", "xxxx"]; 213 shouldBe('regex16.exec(input3);', 'results'); 214 var input4 = "a\u1234\u4321\u3412\u3421b"; 215 var results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; 216 shouldBe('regex16.exec(input4);', 'results'); 217 var input5 = "axbxxbcdefghijb"; 218 var results = ["axbxxb", "xbxx"]; 219 shouldBe('regex16.exec(input5);', 'results'); 220 var input6 = "axxxxxbcdefghijb"; 221 var results = ["axxxxxb", "xxxxx"]; 222 shouldBe('regex16.exec(input6);', 'results'); 223 // Failers 224 var input7 = "a\u1234b"; 225 var results = null; 226 shouldBe('regex16.exec(input7);', 'results'); 227 var input8 = "axxxxxxbcdefghijb"; 228 var results = null; 229 shouldBe('regex16.exec(input8);', 'results'); 230 231 var regex17 = /^[a\u00c0]/; 232 // Failers 233 var input0 = "\u0100"; 234 var results = null; 235 shouldBe('regex17.exec(input0);', 'results'); 236 237 var regex21 = /(?:\u0100){3}b/; 238 var input0 = "\u0100\u0100\u0100b"; 239 var results = ["\u0100\u0100\u0100b"]; 240 shouldBe('regex21.exec(input0);', 'results'); 241 // Failers 242 var input1 = "\u0100\u0100b"; 243 var results = null; 244 shouldBe('regex21.exec(input1);', 'results'); 245 246 var regex22 = /\u00ab/; 247 var input0 = "\u00ab"; 248 var results = ["\u00ab"]; 249 shouldBe('regex22.exec(input0);', 'results'); 250 var input1 = "\xc2\xab"; 251 var results = ["\u00ab"]; 252 shouldBe('regex22.exec(input1);', 'results'); 253 // Failers 254 var input2 = "\x00{ab}"; 255 var results = null; 256 shouldBe('regex22.exec(input2);', 'results'); 257 258 var regex30 = /^[^a]{2}/; 259 var input0 = "\u0100bc"; 260 var results = ["\u0100b"]; 261 shouldBe('regex30.exec(input0);', 'results'); 262 263 var regex31 = /^[^a]{2,}/; 264 var input0 = "\u0100bcAa"; 265 var results = ["\u0100bcA"]; 266 shouldBe('regex31.exec(input0);', 'results'); 267 268 var regex32 = /^[^a]{2,}?/; 269 var input0 = "\u0100bca"; 270 var results = ["\u0100b"]; 271 shouldBe('regex32.exec(input0);', 'results'); 272 273 var regex33 = /^[^a]{2}/i; 274 var input0 = "\u0100bc"; 275 var results = ["\u0100b"]; 276 shouldBe('regex33.exec(input0);', 'results'); 277 278 var regex34 = /^[^a]{2,}/i; 279 var input0 = "\u0100bcAa"; 280 var results = ["\u0100bc"]; 281 shouldBe('regex34.exec(input0);', 'results'); 282 283 var regex35 = /^[^a]{2,}?/i; 284 var input0 = "\u0100bca"; 285 var results = ["\u0100b"]; 286 shouldBe('regex35.exec(input0);', 'results'); 287 288 var regex36 = /\u0100{0,0}/; 289 var input0 = "abcd"; 290 var results = [""]; 291 shouldBe('regex36.exec(input0);', 'results'); 292 293 var regex37 = /\u0100?/; 294 var input0 = "abcd"; 295 var results = [""]; 296 shouldBe('regex37.exec(input0);', 'results'); 297 var input1 = "\u0100\u0100"; 298 var results = ["\u0100"]; 299 shouldBe('regex37.exec(input1);', 'results'); 300 301 var regex38 = /\u0100{0,3}/; 302 var input0 = "\u0100\u0100"; 303 var results = ["\u0100\u0100"]; 304 shouldBe('regex38.exec(input0);', 'results'); 305 var input1 = "\u0100\u0100\u0100\u0100"; 306 var results = ["\u0100\u0100\u0100"]; 307 shouldBe('regex38.exec(input1);', 'results'); 308 309 var regex39 = /\u0100*/; 310 var input0 = "abce"; 311 var results = [""]; 312 shouldBe('regex39.exec(input0);', 'results'); 313 var input1 = "\u0100\u0100\u0100\u0100"; 314 var results = ["\u0100\u0100\u0100\u0100"]; 315 shouldBe('regex39.exec(input1);', 'results'); 316 317 var regex40 = /\u0100{1,1}/; 318 var input0 = "abcd\u0100\u0100\u0100\u0100"; 319 var results = ["\u0100"]; 320 shouldBe('regex40.exec(input0);', 'results'); 321 322 var regex41 = /\u0100{1,3}/; 323 var input0 = "abcd\u0100\u0100\u0100\u0100"; 324 var results = ["\u0100\u0100\u0100"]; 325 shouldBe('regex41.exec(input0);', 'results'); 326 327 var regex42 = /\u0100+/; 328 var input0 = "abcd\u0100\u0100\u0100\u0100"; 329 var results = ["\u0100\u0100\u0100\u0100"]; 330 shouldBe('regex42.exec(input0);', 'results'); 331 332 var regex43 = /\u0100{3}/; 333 var input0 = "abcd\u0100\u0100\u0100XX"; 334 var results = ["\u0100\u0100\u0100"]; 335 shouldBe('regex43.exec(input0);', 'results'); 336 337 var regex44 = /\u0100{3,5}/; 338 var input0 = "abcd\u0100\u0100\u0100\u0100\u0100\u0100\u0100XX"; 339 var results = ["\u0100\u0100\u0100\u0100\u0100"]; 340 shouldBe('regex44.exec(input0);', 'results'); 341 342 var regex45 = /\u0100{3,}/; 343 var input0 = "abcd\u0100\u0100\u0100\u0100\u0100\u0100\u0100XX"; 344 var results = ["\u0100\u0100\u0100\u0100\u0100\u0100\u0100"]; 345 shouldBe('regex45.exec(input0);', 'results'); 346 347 var regex47 = /\D*/; 348 var input0 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; 349 var results = ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]; 350 shouldBe('regex47.exec(input0);', 'results'); 351 352 var regex48 = /\D*/; 353 var input0 = "\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100"; 354 var results = ["\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100"]; 355 shouldBe('regex48.exec(input0);', 'results'); 356 357 var regex49 = /\D/; 358 var input0 = "1X2"; 359 var results = ["X"]; 360 shouldBe('regex49.exec(input0);', 'results'); 361 var input1 = "1\u01002"; 362 var results = ["\u0100"]; 363 shouldBe('regex49.exec(input1);', 'results'); 364 365 var regex50 = />\S/; 366 var input0 = "> >X Y"; 367 var results = [">X"]; 368 shouldBe('regex50.exec(input0);', 'results'); 369 var input1 = "> >\u0100 Y"; 370 var results = [">\u0100"]; 371 shouldBe('regex50.exec(input1);', 'results'); 372 373 var regex51 = /\d/; 374 var input0 = "\u01003"; 375 var results = ["3"]; 376 shouldBe('regex51.exec(input0);', 'results'); 377 378 var regex52 = /\s/; 379 var input0 = "\u0100 X"; 380 var results = [" "]; 381 shouldBe('regex52.exec(input0);', 'results'); 382 383 var regex53 = /\D+/; 384 var input0 = "12abcd34"; 385 var results = ["abcd"]; 386 shouldBe('regex53.exec(input0);', 'results'); 387 // Failers 388 var input1 = "1234"; 389 var results = null; 390 shouldBe('regex53.exec(input1);', 'results'); 391 392 var regex54 = /\D{2,3}/; 393 var input0 = "12abcd34"; 394 var results = ["abc"]; 395 shouldBe('regex54.exec(input0);', 'results'); 396 var input1 = "12ab34"; 397 var results = ["ab"]; 398 shouldBe('regex54.exec(input1);', 'results'); 399 // Failers 400 var input2 = "1234"; 401 var results = null; 402 shouldBe('regex54.exec(input2);', 'results'); 403 var input3 = "12a34"; 404 var results = null; 405 shouldBe('regex54.exec(input3);', 'results'); 406 407 var regex55 = /\D{2,3}?/; 408 var input0 = "12abcd34"; 409 var results = ["ab"]; 410 shouldBe('regex55.exec(input0);', 'results'); 411 var input1 = "12ab34"; 412 var results = ["ab"]; 413 shouldBe('regex55.exec(input1);', 'results'); 414 // Failers 415 var input2 = "1234"; 416 var results = null; 417 shouldBe('regex55.exec(input2);', 'results'); 418 var input3 = "12a34"; 419 var results = null; 420 shouldBe('regex55.exec(input3);', 'results'); 421 422 var regex56 = /\d+/; 423 var input0 = "12abcd34"; 424 var results = ["12"]; 425 shouldBe('regex56.exec(input0);', 'results'); 426 427 var regex57 = /\d{2,3}/; 428 var input0 = "12abcd34"; 429 var results = ["12"]; 430 shouldBe('regex57.exec(input0);', 'results'); 431 var input1 = "1234abcd"; 432 var results = ["123"]; 433 shouldBe('regex57.exec(input1);', 'results'); 434 // Failers 435 var input2 = "1.4"; 436 var results = null; 437 shouldBe('regex57.exec(input2);', 'results'); 438 439 var regex58 = /\d{2,3}?/; 440 var input0 = "12abcd34"; 441 var results = ["12"]; 442 shouldBe('regex58.exec(input0);', 'results'); 443 var input1 = "1234abcd"; 444 var results = ["12"]; 445 shouldBe('regex58.exec(input1);', 'results'); 446 // Failers 447 var input2 = "1.4"; 448 var results = null; 449 shouldBe('regex58.exec(input2);', 'results'); 450 451 var regex59 = /\S+/; 452 var input0 = "12abcd34"; 453 var results = ["12abcd34"]; 454 shouldBe('regex59.exec(input0);', 'results'); 455 // Failers 456 var input1 = " "; 457 var results = null; 458 shouldBe('regex59.exec(input1);', 'results'); 459 460 var regex60 = /\S{2,3}/; 461 var input0 = "12abcd34"; 462 var results = ["12a"]; 463 shouldBe('regex60.exec(input0);', 'results'); 464 var input1 = "1234abcd"; 465 var results = ["123"]; 466 shouldBe('regex60.exec(input1);', 'results'); 467 // Failers 468 var input2 = " "; 469 var results = null; 470 shouldBe('regex60.exec(input2);', 'results'); 471 472 var regex61 = /\S{2,3}?/; 473 var input0 = "12abcd34"; 474 var results = ["12"]; 475 shouldBe('regex61.exec(input0);', 'results'); 476 var input1 = "1234abcd"; 477 var results = ["12"]; 478 shouldBe('regex61.exec(input1);', 'results'); 479 // Failers 480 var input2 = " "; 481 var results = null; 482 shouldBe('regex61.exec(input2);', 'results'); 483 484 var regex62 = />\s+</; 485 var input0 = "12> <34"; 486 var results = ["> <"]; 487 shouldBe('regex62.exec(input0);', 'results'); 488 489 var regex63 = />\s{2,3}</; 490 var input0 = "ab> <cd"; 491 var results = ["> <"]; 492 shouldBe('regex63.exec(input0);', 'results'); 493 var input1 = "ab> <ce"; 494 var results = ["> <"]; 495 shouldBe('regex63.exec(input1);', 'results'); 496 // Failers 497 var input2 = "ab> <cd"; 498 var results = null; 499 shouldBe('regex63.exec(input2);', 'results'); 500 501 var regex64 = />\s{2,3}?</; 502 var input0 = "ab> <cd"; 503 var results = ["> <"]; 504 shouldBe('regex64.exec(input0);', 'results'); 505 var input1 = "ab> <ce"; 506 var results = ["> <"]; 507 shouldBe('regex64.exec(input1);', 'results'); 508 // Failers 509 var input2 = "ab> <cd"; 510 var results = null; 511 shouldBe('regex64.exec(input2);', 'results'); 512 513 var regex65 = /\w+/; 514 var input0 = "12 34"; 515 var results = ["12"]; 516 shouldBe('regex65.exec(input0);', 'results'); 517 // Failers 518 var input1 = "+++=*!"; 519 var results = null; 520 shouldBe('regex65.exec(input1);', 'results'); 521 522 var regex66 = /\w{2,3}/; 523 var input0 = "ab cd"; 524 var results = ["ab"]; 525 shouldBe('regex66.exec(input0);', 'results'); 526 var input1 = "abcd ce"; 527 var results = ["abc"]; 528 shouldBe('regex66.exec(input1);', 'results'); 529 // Failers 530 var input2 = "a.b.c"; 531 var results = null; 532 shouldBe('regex66.exec(input2);', 'results'); 533 534 var regex67 = /\w{2,3}?/; 535 var input0 = "ab cd"; 536 var results = ["ab"]; 537 shouldBe('regex67.exec(input0);', 'results'); 538 var input1 = "abcd ce"; 539 var results = ["ab"]; 540 shouldBe('regex67.exec(input1);', 'results'); 541 // Failers 542 var input2 = "a.b.c"; 543 var results = null; 544 shouldBe('regex67.exec(input2);', 'results'); 545 546 var regex68 = /\W+/; 547 var input0 = "12====34"; 548 var results = ["===="]; 549 shouldBe('regex68.exec(input0);', 'results'); 550 // Failers 551 var input1 = "abcd"; 552 var results = null; 553 shouldBe('regex68.exec(input1);', 'results'); 554 555 var regex69 = /\W{2,3}/; 556 var input0 = "ab====cd"; 557 var results = ["==="]; 558 shouldBe('regex69.exec(input0);', 'results'); 559 var input1 = "ab==cd"; 560 var results = ["=="]; 561 shouldBe('regex69.exec(input1);', 'results'); 562 // Failers 563 var input2 = "a.b.c"; 564 var results = null; 565 shouldBe('regex69.exec(input2);', 'results'); 566 567 var regex70 = /\W{2,3}?/; 568 var input0 = "ab====cd"; 569 var results = ["=="]; 570 shouldBe('regex70.exec(input0);', 'results'); 571 var input1 = "ab==cd"; 572 var results = ["=="]; 573 shouldBe('regex70.exec(input1);', 'results'); 574 // Failers 575 var input2 = "a.b.c"; 576 var results = null; 577 shouldBe('regex70.exec(input2);', 'results'); 578 579 var regex71 = /[\u0100]/; 580 var input0 = "\u0100"; 581 var results = ["\u0100"]; 582 shouldBe('regex71.exec(input0);', 'results'); 583 var input1 = "Z\u0100"; 584 var results = ["\u0100"]; 585 shouldBe('regex71.exec(input1);', 'results'); 586 var input2 = "\u0100Z"; 587 var results = ["\u0100"]; 588 shouldBe('regex71.exec(input2);', 'results'); 589 590 var regex72 = /[Z\u0100]/; 591 var input0 = "Z\u0100"; 592 var results = ["Z"]; 593 shouldBe('regex72.exec(input0);', 'results'); 594 var input1 = "\u0100"; 595 var results = ["\u0100"]; 596 shouldBe('regex72.exec(input1);', 'results'); 597 var input2 = "\u0100Z"; 598 var results = ["\u0100"]; 599 shouldBe('regex72.exec(input2);', 'results'); 600 601 var regex73 = /[\u0100\u0200]/; 602 var input0 = "ab\u0100cd"; 603 var results = ["\u0100"]; 604 shouldBe('regex73.exec(input0);', 'results'); 605 var input1 = "ab\u0200cd"; 606 var results = ["\u0200"]; 607 shouldBe('regex73.exec(input1);', 'results'); 608 609 var regex74 = /[\u0100-\u0200]/; 610 var input0 = "ab\u0100cd"; 611 var results = ["\u0100"]; 612 shouldBe('regex74.exec(input0);', 'results'); 613 var input1 = "ab\u0200cd"; 614 var results = ["\u0200"]; 615 shouldBe('regex74.exec(input1);', 'results'); 616 var input2 = "ab\u0111cd"; 617 var results = ["\u0111"]; 618 shouldBe('regex74.exec(input2);', 'results'); 619 620 var regex75 = /[z-\u0200]/; 621 var input0 = "ab\u0100cd"; 622 var results = ["\u0100"]; 623 shouldBe('regex75.exec(input0);', 'results'); 624 var input1 = "ab\u0200cd"; 625 var results = ["\u0200"]; 626 shouldBe('regex75.exec(input1);', 'results'); 627 var input2 = "ab\u0111cd"; 628 var results = ["\u0111"]; 629 shouldBe('regex75.exec(input2);', 'results'); 630 var input3 = "abzcd"; 631 var results = ["z"]; 632 shouldBe('regex75.exec(input3);', 'results'); 633 var input4 = "ab|cd"; 634 var results = ["|"]; 635 shouldBe('regex75.exec(input4);', 'results'); 636 637 var regex76 = /[Q\u0100\u0200]/; 638 var input0 = "ab\u0100cd"; 639 var results = ["\u0100"]; 640 shouldBe('regex76.exec(input0);', 'results'); 641 var input1 = "ab\u0200cd"; 642 var results = ["\u0200"]; 643 shouldBe('regex76.exec(input1);', 'results'); 644 var input2 = "Q?"; 645 var results = ["Q"]; 646 shouldBe('regex76.exec(input2);', 'results'); 647 648 var regex77 = /[Q\u0100-\u0200]/; 649 var input0 = "ab\u0100cd"; 650 var results = ["\u0100"]; 651 shouldBe('regex77.exec(input0);', 'results'); 652 var input1 = "ab\u0200cd"; 653 var results = ["\u0200"]; 654 shouldBe('regex77.exec(input1);', 'results'); 655 var input2 = "ab\u0111cd"; 656 var results = ["\u0111"]; 657 shouldBe('regex77.exec(input2);', 'results'); 658 var input3 = "Q?"; 659 var results = ["Q"]; 660 shouldBe('regex77.exec(input3);', 'results'); 661 662 var regex78 = /[Qz-\u0200]/; 663 var input0 = "ab\u0100cd"; 664 var results = ["\u0100"]; 665 shouldBe('regex78.exec(input0);', 'results'); 666 var input1 = "ab\u0200cd"; 667 var results = ["\u0200"]; 668 shouldBe('regex78.exec(input1);', 'results'); 669 var input2 = "ab\u0111cd"; 670 var results = ["\u0111"]; 671 shouldBe('regex78.exec(input2);', 'results'); 672 var input3 = "abzcd"; 673 var results = ["z"]; 674 shouldBe('regex78.exec(input3);', 'results'); 675 var input4 = "ab|cd"; 676 var results = ["|"]; 677 shouldBe('regex78.exec(input4);', 'results'); 678 var input5 = "Q?"; 679 var results = ["Q"]; 680 shouldBe('regex78.exec(input5);', 'results'); 681 682 var regex79 = /[\u0100\u0200]{1,3}/; 683 var input0 = "ab\u0100cd"; 684 var results = ["\u0100"]; 685 shouldBe('regex79.exec(input0);', 'results'); 686 var input1 = "ab\u0200cd"; 687 var results = ["\u0200"]; 688 shouldBe('regex79.exec(input1);', 'results'); 689 var input2 = "ab\u0200\u0100\u0200\u0100cd"; 690 var results = ["\u0200\u0100\u0200"]; 691 shouldBe('regex79.exec(input2);', 'results'); 692 693 var regex80 = /[\u0100\u0200]{1,3}?/; 694 var input0 = "ab\u0100cd"; 695 var results = ["\u0100"]; 696 shouldBe('regex80.exec(input0);', 'results'); 697 var input1 = "ab\u0200cd"; 698 var results = ["\u0200"]; 699 shouldBe('regex80.exec(input1);', 'results'); 700 var input2 = "ab\u0200\u0100\u0200\u0100cd"; 701 var results = ["\u0200"]; 702 shouldBe('regex80.exec(input2);', 'results'); 703 704 var regex81 = /[Q\u0100\u0200]{1,3}/; 705 var input0 = "ab\u0100cd"; 706 var results = ["\u0100"]; 707 shouldBe('regex81.exec(input0);', 'results'); 708 var input1 = "ab\u0200cd"; 709 var results = ["\u0200"]; 710 shouldBe('regex81.exec(input1);', 'results'); 711 var input2 = "ab\u0200\u0100\u0200\u0100cd"; 712 var results = ["\u0200\u0100\u0200"]; 713 shouldBe('regex81.exec(input2);', 'results'); 714 715 var regex82 = /[Q\u0100\u0200]{1,3}?/; 716 var input0 = "ab\u0100cd"; 717 var results = ["\u0100"]; 718 shouldBe('regex82.exec(input0);', 'results'); 719 var input1 = "ab\u0200cd"; 720 var results = ["\u0200"]; 721 shouldBe('regex82.exec(input1);', 'results'); 722 var input2 = "ab\u0200\u0100\u0200\u0100cd"; 723 var results = ["\u0200"]; 724 shouldBe('regex82.exec(input2);', 'results'); 725 726 var regex86 = /[^\u0100\u0200]X/; 727 var input0 = "AX"; 728 var results = ["AX"]; 729 shouldBe('regex86.exec(input0);', 'results'); 730 var input1 = "\u0150X"; 731 var results = ["\u0150X"]; 732 shouldBe('regex86.exec(input1);', 'results'); 733 var input2 = "\u0500X"; 734 var results = ["\u0500X"]; 735 shouldBe('regex86.exec(input2);', 'results'); 736 // Failers 737 var input3 = "\u0100X"; 738 var results = null; 739 shouldBe('regex86.exec(input3);', 'results'); 740 var input4 = "\u0200X"; 741 var results = null; 742 shouldBe('regex86.exec(input4);', 'results'); 743 744 var regex87 = /[^Q\u0100\u0200]X/; 745 var input0 = "AX"; 746 var results = ["AX"]; 747 shouldBe('regex87.exec(input0);', 'results'); 748 var input1 = "\u0150X"; 749 var results = ["\u0150X"]; 750 shouldBe('regex87.exec(input1);', 'results'); 751 var input2 = "\u0500X"; 752 var results = ["\u0500X"]; 753 shouldBe('regex87.exec(input2);', 'results'); 754 // Failers 755 var input3 = "\u0100X"; 756 var results = null; 757 shouldBe('regex87.exec(input3);', 'results'); 758 var input4 = "\u0200X"; 759 var results = null; 760 shouldBe('regex87.exec(input4);', 'results'); 761 var input5 = "QX"; 762 var results = null; 763 shouldBe('regex87.exec(input5);', 'results'); 764 765 var regex88 = /[^\u0100-\u0200]X/; 766 var input0 = "AX"; 767 var results = ["AX"]; 768 shouldBe('regex88.exec(input0);', 'results'); 769 var input1 = "\u0500X"; 770 var results = ["\u0500X"]; 771 shouldBe('regex88.exec(input1);', 'results'); 772 // Failers 773 var input2 = "\u0100X"; 774 var results = null; 775 shouldBe('regex88.exec(input2);', 'results'); 776 var input3 = "\u0150X"; 777 var results = null; 778 shouldBe('regex88.exec(input3);', 'results'); 779 var input4 = "\u0200X"; 780 var results = null; 781 shouldBe('regex88.exec(input4);', 'results'); 782 783 var regex91 = /[z-\u0100]/i; 784 var input0 = "z"; 785 var results = ["z"]; 786 shouldBe('regex91.exec(input0);', 'results'); 787 var input1 = "Z"; 788 var results = ["Z"]; 789 shouldBe('regex91.exec(input1);', 'results'); 790 var input2 = "\u0100"; 791 var results = ["\u0100"]; 792 shouldBe('regex91.exec(input2);', 'results'); 793 // Failers 794 var input3 = "\u0102"; 795 var results = null; 796 shouldBe('regex91.exec(input3);', 'results'); 797 var input4 = "y"; 798 var results = null; 799 shouldBe('regex91.exec(input4);', 'results'); 800 801 var regex92 = /[\xFF]/; 802 var input0 = ">\xff<"; 803 var results = ["\xff"]; 804 shouldBe('regex92.exec(input0);', 'results'); 805 806 var regex93 = /[\xff]/; 807 var input0 = ">\u00ff<"; 808 var results = ["\u00ff"]; 809 shouldBe('regex93.exec(input0);', 'results'); 810 811 var regex94 = /[^\xFF]/; 812 var input0 = "XYZ"; 813 var results = ["X"]; 814 shouldBe('regex94.exec(input0);', 'results'); 815 816 var regex95 = /[^\xff]/; 817 var input0 = "XYZ"; 818 var results = ["X"]; 819 shouldBe('regex95.exec(input0);', 'results'); 820 var input1 = "\u0123"; 821 var results = ["\u0123"]; 822 shouldBe('regex95.exec(input1);', 'results'); 823 824 var regex96 = /^[ac]*b/; 825 var input0 = "xb"; 826 var results = null; 827 shouldBe('regex96.exec(input0);', 'results'); 828 829 var regex97 = /^[ac\u0100]*b/; 830 var input0 = "xb"; 831 var results = null; 832 shouldBe('regex97.exec(input0);', 'results'); 833 834 var regex98 = /^[^x]*b/i; 835 var input0 = "xb"; 836 var results = null; 837 shouldBe('regex98.exec(input0);', 'results'); 838 839 var regex99 = /^[^x]*b/; 840 var input0 = "xb"; 841 var results = null; 842 shouldBe('regex99.exec(input0);', 'results'); 843 844 var regex100 = /^\d*b/; 845 var input0 = "xb"; 846 var results = null; 847 shouldBe('regex100.exec(input0);', 'results'); 848 849 var regex102 = /^\u0085$/i; 850 var input0 = "\u0085"; 851 var results = ["\u0085"]; 852 shouldBe('regex102.exec(input0);', 'results'); 853 854 var regex103 = /^\xe1\x88\xb4/; 855 var input0 = "\xe1\x88\xb4"; 856 var results = ["\xe1\x88\xb4"]; 857 shouldBe('regex103.exec(input0);', 'results'); 858 859 var regex104 = /^\xe1\x88\xb4/; 860 var input0 = "\xe1\x88\xb4"; 861 var results = ["\xe1\x88\xb4"]; 862 shouldBe('regex104.exec(input0);', 'results'); 863 864 var regex105 = /(.{1,5})/; 865 var input0 = "abcdefg"; 866 var results = ["abcde", "abcde"]; 867 shouldBe('regex105.exec(input0);', 'results'); 868 var input1 = "ab"; 869 var results = ["ab", "ab"]; 870 shouldBe('regex105.exec(input1);', 'results'); 871 872 var regex106 = /a*\u0100*\w/; 873 var input0 = "a"; 874 var results = ["a"]; 875 shouldBe('regex106.exec(input0);', 'results'); 876 877 var regex107 = /[\S\s]*/; 878 var input0 = "abc\n\r\u0442\u0435\u0441\u0442xyz"; 879 var results = ["abc\u000a\u000d\u0442\u0435\u0441\u0442xyz"]; 880 shouldBe('regex107.exec(input0);', 'results'); 881 882 var regexGlobal0 = /[^a]+/g; 883 var input0 = "bcd"; 884 var results = ["bcd"]; 885 shouldBe('input0.match(regexGlobal0);', 'results'); 886 var input1 = "\u0100aY\u0256Z"; 887 var results = ["\u0100", "Y\u0256Z"]; 888 shouldBe('input1.match(regexGlobal0);', 'results'); 889 890 var regexGlobal1 = /\S\S/g; 891 var input0 = "A\u00a3BC"; 892 var results = ["A\u00a3", "BC"]; 893 shouldBe('input0.match(regexGlobal1);', 'results'); 894 895 var regexGlobal2 = /\S{2}/g; 896 var input0 = "A\u00a3BC"; 897 var results = ["A\u00a3", "BC"]; 898 shouldBe('input0.match(regexGlobal2);', 'results'); 899 900 var regexGlobal3 = /\W\W/g; 901 var input0 = "+\u00a3=="; 902 var results = ["+\u00a3", "=="]; 903 shouldBe('input0.match(regexGlobal3);', 'results'); 904 905 var regexGlobal4 = /\W{2}/g; 906 var input0 = "+\u00a3=="; 907 var results = ["+\u00a3", "=="]; 908 shouldBe('input0.match(regexGlobal4);', 'results'); 909 910 var regexGlobal5 = /\S/g; 911 var input0 = "\u0442\u0435\u0441\u0442"; 912 var results = ["\u0442", "\u0435", "\u0441", "\u0442"]; 913 shouldBe('input0.match(regexGlobal5);', 'results'); 914 915 var regexGlobal6 = /[\S]/g; 916 var input0 = "\u0442\u0435\u0441\u0442"; 917 var results = ["\u0442", "\u0435", "\u0441", "\u0442"]; 918 shouldBe('input0.match(regexGlobal6);', 'results'); 919 920 var regexGlobal7 = /\D/g; 921 var input0 = "\u0442\u0435\u0441\u0442"; 922 var results = ["\u0442", "\u0435", "\u0441", "\u0442"]; 923 shouldBe('input0.match(regexGlobal7);', 'results'); 924 925 var regexGlobal8 = /[\D]/g; 926 var input0 = "\u0442\u0435\u0441\u0442"; 927 var results = ["\u0442", "\u0435", "\u0441", "\u0442"]; 928 shouldBe('input0.match(regexGlobal8);', 'results'); 929 930 var regexGlobal9 = /\W/g; 931 var input0 = "\u2442\u2435\u2441\u2442"; 932 var results = ["\u2442", "\u2435", "\u2441", "\u2442"]; 933 shouldBe('input0.match(regexGlobal9);', 'results'); 934 935 var regexGlobal10 = /[\W]/g; 936 var input0 = "\u2442\u2435\u2441\u2442"; 937 var results = ["\u2442", "\u2435", "\u2441", "\u2442"]; 938 shouldBe('input0.match(regexGlobal10);', 'results'); 939 940 var regexGlobal11 = /[\u041f\S]/g; 941 var input0 = "\u0442\u0435\u0441\u0442"; 942 var results = ["\u0442", "\u0435", "\u0441", "\u0442"]; 943 shouldBe('input0.match(regexGlobal11);', 'results'); 944 945 var regexGlobal12 = /.[^\S]./g; 946 var input0 = "abc def\u0442\u0443xyz\npqr"; 947 var results = ["c d", "z\u000ap"]; 948 shouldBe('input0.match(regexGlobal12);', 'results'); 949 950 var regexGlobal13 = /.[^\S\n]./g; 951 var input0 = "abc def\u0442\u0443xyz\npqr"; 952 var results = ["c d"]; 953 shouldBe('input0.match(regexGlobal13);', 'results'); 954 955 var regexGlobal14 = /[\W]/g; 956 var input0 = "+\u2442"; 957 var results = ["+", "\u2442"]; 958 shouldBe('input0.match(regexGlobal14);', 'results'); 959 960 var regexGlobal15 = /[^a-zA-Z]/g; 961 var input0 = "+\u2442"; 962 var results = ["+", "\u2442"]; 963 shouldBe('input0.match(regexGlobal15);', 'results'); 964 965 var regexGlobal16 = /[^a-zA-Z]/g; 966 var input0 = "A\u0442"; 967 var results = ["\u0442"]; 968 shouldBe('input0.match(regexGlobal16);', 'results'); 969 970 var regexGlobal17 = /[\S]/g; 971 var input0 = "A\u0442"; 972 var results = ["A", "\u0442"]; 973 shouldBe('input0.match(regexGlobal17);', 'results'); 974 975 var regexGlobal19 = /[\D]/g; 976 var input0 = "A\u0442"; 977 var results = ["A", "\u0442"]; 978 shouldBe('input0.match(regexGlobal19);', 'results'); 979 980 var regexGlobal21 = /[^a-z]/g; 981 var input0 = "A\u0422"; 982 var results = ["A", "\u0422"]; 983 shouldBe('input0.match(regexGlobal21);', 'results'); 984 985 var regexGlobal24 = /[\S]/g; 986 var input0 = "A\u0442"; 987 var results = ["A", "\u0442"]; 988 shouldBe('input0.match(regexGlobal24);', 'results'); 989 990 var regexGlobal25 = /[^A-Z]/g; 991 var input0 = "a\u0442"; 992 var results = ["a", "\u0442"]; 993 shouldBe('input0.match(regexGlobal25);', 'results'); 994 995 var regexGlobal26 = /[\W]/g; 996 var input0 = "+\u2442"; 997 var results = ["+", "\u2442"]; 998 shouldBe('input0.match(regexGlobal26);', 'results'); 999 1000 var regexGlobal27 = /[\D]/g; 1001 var input0 = "M\u0442"; 1002 var results = ["M", "\u0442"]; 1003 shouldBe('input0.match(regexGlobal27);', 'results'); 1004 1005 var regexGlobal28 = /[^a]+/ig; 1006 var input0 = "bcd"; 1007 var results = ["bcd"]; 1008 shouldBe('input0.match(regexGlobal28);', 'results'); 1009 var input1 = "\u0100aY\u0256Z"; 1010 var results = ["\u0100", "Y\u0256Z"]; 1011 shouldBe('input1.match(regexGlobal28);', 'results'); 1012 1013 var regexGlobal29 = /(a|)/g; 1014 var input0 = "catac"; 1015 var results = ["", "a", "", "a", "", ""]; 1016 shouldBe('input0.match(regexGlobal29);', 'results'); 1017 var input1 = "a\u0256a"; 1018 var results = ["a", "", "a", ""]; 1019 shouldBe('input1.match(regexGlobal29);', 'results'); 1020 1021 // DISABLED: 1022 // These tests use (?<) or (?>) constructs. These are not currently valid in ECMAScript, 1023 // but these tests may be useful if similar constructs are introduced in the future. 1024 1025 //var regex18 = /(?<=aXb)cd/; 1026 //var input0 = "aXbcd"; 1027 //var results = ["cd"]; 1028 //shouldBe('regex18.exec(input0);', 'results'); 1029 // 1030 //var regex19 = /(?<=a\u0100b)cd/; 1031 //var input0 = "a\u0100bcd"; 1032 //var results = ["cd"]; 1033 //shouldBe('regex19.exec(input0);', 'results'); 1034 // 1035 //var regex20 = /(?<=a\u100000b)cd/; 1036 //var input0 = "a\u100000bcd"; 1037 //var results = ["cd"]; 1038 //shouldBe('regex20.exec(input0);', 'results'); 1039 // 1040 //var regex23 = /(?<=(.))X/; 1041 //var input0 = "WXYZ"; 1042 //var results = ["X", "W"]; 1043 //shouldBe('regex23.exec(input0);', 'results'); 1044 //var input1 = "\u0256XYZ"; 1045 //var results = ["X", "\u0256"]; 1046 //shouldBe('regex23.exec(input1);', 'results'); 1047 //// Failers 1048 //var input2 = "XYZ"; 1049 //var results = null; 1050 //shouldBe('regex23.exec(input2);', 'results'); 1051 // 1052 //var regex46 = /(?<=a\u0100{2}b)X/; 1053 //var input0 = "Xyyya\u0100\u0100bXzzz"; 1054 //var results = ["X"]; 1055 //shouldBe('regex46.exec(input0);', 'results'); 1056 // 1057 //var regex83 = /(?<=[\u0100\u0200])X/; 1058 //var input0 = "abc\u0200X"; 1059 //var results = ["X"]; 1060 //shouldBe('regex83.exec(input0);', 'results'); 1061 //var input1 = "abc\u0100X"; 1062 //var results = ["X"]; 1063 //shouldBe('regex83.exec(input1);', 'results'); 1064 //// Failers 1065 //var input2 = "X"; 1066 //var results = null; 1067 //shouldBe('regex83.exec(input2);', 'results'); 1068 // 1069 //var regex84 = /(?<=[Q\u0100\u0200])X/; 1070 //var input0 = "abc\u0200X"; 1071 //var results = ["X"]; 1072 //shouldBe('regex84.exec(input0);', 'results'); 1073 //var input1 = "abc\u0100X"; 1074 //var results = ["X"]; 1075 //shouldBe('regex84.exec(input1);', 'results'); 1076 //var input2 = "abQX"; 1077 //var results = ["X"]; 1078 //shouldBe('regex84.exec(input2);', 'results'); 1079 //// Failers 1080 //var input3 = "X"; 1081 //var results = null; 1082 //shouldBe('regex84.exec(input3);', 'results'); 1083 // 1084 //var regex85 = /(?<=[\u0100\u0200]{3})X/; 1085 //var input0 = "abc\u0100\u0200\u0100X"; 1086 //var results = ["X"]; 1087 //shouldBe('regex85.exec(input0);', 'results'); 1088 //// Failers 1089 //var input1 = "abc\u0200X"; 1090 //var results = null; 1091 //shouldBe('regex85.exec(input1);', 'results'); 1092 //var input2 = "X"; 1093 //var results = null; 1094 //shouldBe('regex85.exec(input2);', 'results'); 1095 1096 // DISABLED: 1097 // These tests use PCRE's \C token. This is not currently valid in ECMAScript, 1098 // but these tests may be useful if similar constructs are introduced in the future. 1099 1100 //var regex24 = /X(\C{3})/; 1101 //var input0 = "X\u1234"; 1102 //var results = ["X\u1234", "\u1234"]; 1103 //shouldBe('regex24.exec(input0);', 'results'); 1104 // 1105 //var regex25 = /X(\C{4})/; 1106 //var input0 = "X\u1234YZ"; 1107 //var results = ["X\u1234Y", "\u1234Y"]; 1108 //shouldBe('regex25.exec(input0);', 'results'); 1109 // 1110 //var regex26 = /X\C*/; 1111 //var input0 = "XYZabcdce"; 1112 //var results = ["XYZabcdce"]; 1113 //shouldBe('regex26.exec(input0);', 'results'); 1114 // 1115 //var regex27 = /X\C*?/; 1116 //var input0 = "XYZabcde"; 1117 //var results = ["X"]; 1118 //shouldBe('regex27.exec(input0);', 'results'); 1119 // 1120 //var regex28 = /X\C{3,5}/; 1121 //var input0 = "Xabcdefg"; 1122 //var results = ["Xabcde"]; 1123 //shouldBe('regex28.exec(input0);', 'results'); 1124 //var input1 = "X\u1234"; 1125 //var results = ["X\u1234"]; 1126 //shouldBe('regex28.exec(input1);', 'results'); 1127 //var input2 = "X\u1234YZ"; 1128 //var results = ["X\u1234YZ"]; 1129 //shouldBe('regex28.exec(input2);', 'results'); 1130 //var input3 = "X\u1234\u0512"; 1131 //var results = ["X\u1234\u0512"]; 1132 //shouldBe('regex28.exec(input3);', 'results'); 1133 //var input4 = "X\u1234\u0512YZ"; 1134 //var results = ["X\u1234\u0512"]; 1135 //shouldBe('regex28.exec(input4);', 'results'); 1136 // 1137 //var regex29 = /X\C{3,5}?/; 1138 //var input0 = "Xabcdefg"; 1139 //var results = ["Xabc"]; 1140 //shouldBe('regex29.exec(input0);', 'results'); 1141 //var input1 = "X\u1234"; 1142 //var results = ["X\u1234"]; 1143 //shouldBe('regex29.exec(input1);', 'results'); 1144 //var input2 = "X\u1234YZ"; 1145 //var results = ["X\u1234"]; 1146 //shouldBe('regex29.exec(input2);', 'results'); 1147 //var input3 = "X\u1234\u0512"; 1148 //var results = ["X\u1234"]; 1149 //shouldBe('regex29.exec(input3);', 'results'); 1150 // 1151 //var regex89 = /a\Cb/; 1152 //var input0 = "aXb"; 1153 //var results = ["aXb"]; 1154 //shouldBe('regex89.exec(input0);', 'results'); 1155 //var input1 = "a\nb"; 1156 //var results = ["a\x0ab"]; 1157 //shouldBe('regex89.exec(input1);', 'results'); 1158 // 1159 //var regex90 = /a\Cb/; 1160 //var input0 = "aXb"; 1161 //var results = ["aXb"]; 1162 //shouldBe('regex90.exec(input0);', 'results'); 1163 //var input1 = "a\nb"; 1164 //var results = ["a\u000ab"]; 1165 //shouldBe('regex90.exec(input1);', 'results'); 1166 //// Failers 1167 //var input2 = "a\u0100b"; 1168 //var results = null; 1169 //shouldBe('regex90.exec(input2);', 'results'); 1170