|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 /* |
|
7 * |
|
8 * Date: 2002-07-07 |
|
9 * SUMMARY: Testing JS RegExp engine against Perl 5 RegExp engine. |
|
10 * Adjust cnLBOUND, cnUBOUND below to restrict which sections are tested. |
|
11 * |
|
12 * This test was created by running various patterns and strings through the |
|
13 * Perl 5 RegExp engine. We saved the results below to test the JS engine. |
|
14 * |
|
15 * NOTE: ECMA/JS and Perl do differ on certain points. We have either commented |
|
16 * out such sections altogether, or modified them to fit what we expect from JS. |
|
17 * |
|
18 * EXAMPLES: |
|
19 * |
|
20 * - In JS, regexp captures (/(a) etc./) must hold |undefined| if not used. |
|
21 * See http://bugzilla.mozilla.org/show_bug.cgi?id=123437. |
|
22 * By contrast, in Perl, unmatched captures hold the empty string. |
|
23 * We have modified such sections accordingly. Example: |
|
24 |
|
25 pattern = /^([^a-z])|(\^)$/; |
|
26 string = '.'; |
|
27 actualmatch = string.match(pattern); |
|
28 //expectedmatch = Array('.', '.', ''); <<<--- Perl |
|
29 expectedmatch = Array('.', '.', undefined); <<<--- JS |
|
30 addThis(); |
|
31 |
|
32 |
|
33 * - In JS, you can't refer to a capture before it's encountered & completed |
|
34 * |
|
35 * - Perl supports ] & ^] inside a [], ECMA does not |
|
36 * |
|
37 * - ECMA does support (?: (?= and (?! operators, but doesn't support (?< etc. |
|
38 * |
|
39 * - ECMA doesn't support (?imsx or (?-imsx |
|
40 * |
|
41 * - ECMA doesn't support (?(condition) |
|
42 * |
|
43 * - Perl has \Z has end-of-line, ECMA doesn't |
|
44 * |
|
45 * - In ECMA, ^ matches only the empty string before the first character |
|
46 * |
|
47 * - In ECMA, $ matches only the empty string at end of input (unless multiline) |
|
48 * |
|
49 * - ECMA spec says that each atom in a range must be a single character |
|
50 * |
|
51 * - ECMA doesn't support \A |
|
52 * |
|
53 * - ECMA doesn't have rules for [: |
|
54 * |
|
55 */ |
|
56 //----------------------------------------------------------------------------- |
|
57 var i = 0; |
|
58 var BUGNUMBER = 85721; |
|
59 var summary = 'Testing regular expression edge cases'; |
|
60 var cnSingleSpace = ' '; |
|
61 var status = ''; |
|
62 var statusmessages = new Array(); |
|
63 var pattern = ''; |
|
64 var patterns = new Array(); |
|
65 var string = ''; |
|
66 var strings = new Array(); |
|
67 var actualmatch = ''; |
|
68 var actualmatches = new Array(); |
|
69 var expectedmatch = ''; |
|
70 var expectedmatches = new Array(); |
|
71 var cnLBOUND = 1; |
|
72 var cnUBOUND = 1000; |
|
73 |
|
74 |
|
75 status = inSection(1); |
|
76 pattern = /abc/; |
|
77 string = 'abc'; |
|
78 actualmatch = string.match(pattern); |
|
79 expectedmatch = Array('abc'); |
|
80 addThis(); |
|
81 |
|
82 status = inSection(2); |
|
83 pattern = /abc/; |
|
84 string = 'xabcy'; |
|
85 actualmatch = string.match(pattern); |
|
86 expectedmatch = Array('abc'); |
|
87 addThis(); |
|
88 |
|
89 status = inSection(3); |
|
90 pattern = /abc/; |
|
91 string = 'ababc'; |
|
92 actualmatch = string.match(pattern); |
|
93 expectedmatch = Array('abc'); |
|
94 addThis(); |
|
95 |
|
96 status = inSection(4); |
|
97 pattern = /ab*c/; |
|
98 string = 'abc'; |
|
99 actualmatch = string.match(pattern); |
|
100 expectedmatch = Array('abc'); |
|
101 addThis(); |
|
102 |
|
103 status = inSection(5); |
|
104 pattern = /ab*bc/; |
|
105 string = 'abc'; |
|
106 actualmatch = string.match(pattern); |
|
107 expectedmatch = Array('abc'); |
|
108 addThis(); |
|
109 |
|
110 status = inSection(6); |
|
111 pattern = /ab*bc/; |
|
112 string = 'abbc'; |
|
113 actualmatch = string.match(pattern); |
|
114 expectedmatch = Array('abbc'); |
|
115 addThis(); |
|
116 |
|
117 status = inSection(7); |
|
118 pattern = /ab*bc/; |
|
119 string = 'abbbbc'; |
|
120 actualmatch = string.match(pattern); |
|
121 expectedmatch = Array('abbbbc'); |
|
122 addThis(); |
|
123 |
|
124 status = inSection(8); |
|
125 pattern = /.{1}/; |
|
126 string = 'abbbbc'; |
|
127 actualmatch = string.match(pattern); |
|
128 expectedmatch = Array('a'); |
|
129 addThis(); |
|
130 |
|
131 status = inSection(9); |
|
132 pattern = /.{3,4}/; |
|
133 string = 'abbbbc'; |
|
134 actualmatch = string.match(pattern); |
|
135 expectedmatch = Array('abbb'); |
|
136 addThis(); |
|
137 |
|
138 status = inSection(10); |
|
139 pattern = /ab{0,}bc/; |
|
140 string = 'abbbbc'; |
|
141 actualmatch = string.match(pattern); |
|
142 expectedmatch = Array('abbbbc'); |
|
143 addThis(); |
|
144 |
|
145 status = inSection(11); |
|
146 pattern = /ab+bc/; |
|
147 string = 'abbc'; |
|
148 actualmatch = string.match(pattern); |
|
149 expectedmatch = Array('abbc'); |
|
150 addThis(); |
|
151 |
|
152 status = inSection(12); |
|
153 pattern = /ab+bc/; |
|
154 string = 'abbbbc'; |
|
155 actualmatch = string.match(pattern); |
|
156 expectedmatch = Array('abbbbc'); |
|
157 addThis(); |
|
158 |
|
159 status = inSection(13); |
|
160 pattern = /ab{1,}bc/; |
|
161 string = 'abbbbc'; |
|
162 actualmatch = string.match(pattern); |
|
163 expectedmatch = Array('abbbbc'); |
|
164 addThis(); |
|
165 |
|
166 status = inSection(14); |
|
167 pattern = /ab{1,3}bc/; |
|
168 string = 'abbbbc'; |
|
169 actualmatch = string.match(pattern); |
|
170 expectedmatch = Array('abbbbc'); |
|
171 addThis(); |
|
172 |
|
173 status = inSection(15); |
|
174 pattern = /ab{3,4}bc/; |
|
175 string = 'abbbbc'; |
|
176 actualmatch = string.match(pattern); |
|
177 expectedmatch = Array('abbbbc'); |
|
178 addThis(); |
|
179 |
|
180 status = inSection(16); |
|
181 pattern = /ab?bc/; |
|
182 string = 'abbc'; |
|
183 actualmatch = string.match(pattern); |
|
184 expectedmatch = Array('abbc'); |
|
185 addThis(); |
|
186 |
|
187 status = inSection(17); |
|
188 pattern = /ab?bc/; |
|
189 string = 'abc'; |
|
190 actualmatch = string.match(pattern); |
|
191 expectedmatch = Array('abc'); |
|
192 addThis(); |
|
193 |
|
194 status = inSection(18); |
|
195 pattern = /ab{0,1}bc/; |
|
196 string = 'abc'; |
|
197 actualmatch = string.match(pattern); |
|
198 expectedmatch = Array('abc'); |
|
199 addThis(); |
|
200 |
|
201 status = inSection(19); |
|
202 pattern = /ab?c/; |
|
203 string = 'abc'; |
|
204 actualmatch = string.match(pattern); |
|
205 expectedmatch = Array('abc'); |
|
206 addThis(); |
|
207 |
|
208 status = inSection(20); |
|
209 pattern = /ab{0,1}c/; |
|
210 string = 'abc'; |
|
211 actualmatch = string.match(pattern); |
|
212 expectedmatch = Array('abc'); |
|
213 addThis(); |
|
214 |
|
215 status = inSection(21); |
|
216 pattern = /^abc$/; |
|
217 string = 'abc'; |
|
218 actualmatch = string.match(pattern); |
|
219 expectedmatch = Array('abc'); |
|
220 addThis(); |
|
221 |
|
222 status = inSection(22); |
|
223 pattern = /^abc/; |
|
224 string = 'abcc'; |
|
225 actualmatch = string.match(pattern); |
|
226 expectedmatch = Array('abc'); |
|
227 addThis(); |
|
228 |
|
229 status = inSection(23); |
|
230 pattern = /abc$/; |
|
231 string = 'aabc'; |
|
232 actualmatch = string.match(pattern); |
|
233 expectedmatch = Array('abc'); |
|
234 addThis(); |
|
235 |
|
236 status = inSection(24); |
|
237 pattern = /^/; |
|
238 string = 'abc'; |
|
239 actualmatch = string.match(pattern); |
|
240 expectedmatch = Array(''); |
|
241 addThis(); |
|
242 |
|
243 status = inSection(25); |
|
244 pattern = /$/; |
|
245 string = 'abc'; |
|
246 actualmatch = string.match(pattern); |
|
247 expectedmatch = Array(''); |
|
248 addThis(); |
|
249 |
|
250 status = inSection(26); |
|
251 pattern = /a.c/; |
|
252 string = 'abc'; |
|
253 actualmatch = string.match(pattern); |
|
254 expectedmatch = Array('abc'); |
|
255 addThis(); |
|
256 |
|
257 status = inSection(27); |
|
258 pattern = /a.c/; |
|
259 string = 'axc'; |
|
260 actualmatch = string.match(pattern); |
|
261 expectedmatch = Array('axc'); |
|
262 addThis(); |
|
263 |
|
264 status = inSection(28); |
|
265 pattern = /a.*c/; |
|
266 string = 'axyzc'; |
|
267 actualmatch = string.match(pattern); |
|
268 expectedmatch = Array('axyzc'); |
|
269 addThis(); |
|
270 |
|
271 status = inSection(29); |
|
272 pattern = /a[bc]d/; |
|
273 string = 'abd'; |
|
274 actualmatch = string.match(pattern); |
|
275 expectedmatch = Array('abd'); |
|
276 addThis(); |
|
277 |
|
278 status = inSection(30); |
|
279 pattern = /a[b-d]e/; |
|
280 string = 'ace'; |
|
281 actualmatch = string.match(pattern); |
|
282 expectedmatch = Array('ace'); |
|
283 addThis(); |
|
284 |
|
285 status = inSection(31); |
|
286 pattern = /a[b-d]/; |
|
287 string = 'aac'; |
|
288 actualmatch = string.match(pattern); |
|
289 expectedmatch = Array('ac'); |
|
290 addThis(); |
|
291 |
|
292 status = inSection(32); |
|
293 pattern = /a[-b]/; |
|
294 string = 'a-'; |
|
295 actualmatch = string.match(pattern); |
|
296 expectedmatch = Array('a-'); |
|
297 addThis(); |
|
298 |
|
299 status = inSection(33); |
|
300 pattern = /a[b-]/; |
|
301 string = 'a-'; |
|
302 actualmatch = string.match(pattern); |
|
303 expectedmatch = Array('a-'); |
|
304 addThis(); |
|
305 |
|
306 status = inSection(34); |
|
307 pattern = /a]/; |
|
308 string = 'a]'; |
|
309 actualmatch = string.match(pattern); |
|
310 expectedmatch = Array('a]'); |
|
311 addThis(); |
|
312 |
|
313 /* Perl supports ] & ^] inside a [], ECMA does not |
|
314 pattern = /a[]]b/; |
|
315 status = inSection(35); |
|
316 string = 'a]b'; |
|
317 actualmatch = string.match(pattern); |
|
318 expectedmatch = Array('a]b'); |
|
319 addThis(); |
|
320 */ |
|
321 |
|
322 status = inSection(36); |
|
323 pattern = /a[^bc]d/; |
|
324 string = 'aed'; |
|
325 actualmatch = string.match(pattern); |
|
326 expectedmatch = Array('aed'); |
|
327 addThis(); |
|
328 |
|
329 status = inSection(37); |
|
330 pattern = /a[^-b]c/; |
|
331 string = 'adc'; |
|
332 actualmatch = string.match(pattern); |
|
333 expectedmatch = Array('adc'); |
|
334 addThis(); |
|
335 |
|
336 /* Perl supports ] & ^] inside a [], ECMA does not |
|
337 status = inSection(38); |
|
338 pattern = /a[^]b]c/; |
|
339 string = 'adc'; |
|
340 actualmatch = string.match(pattern); |
|
341 expectedmatch = Array('adc'); |
|
342 addThis(); |
|
343 */ |
|
344 |
|
345 status = inSection(39); |
|
346 pattern = /\ba\b/; |
|
347 string = 'a-'; |
|
348 actualmatch = string.match(pattern); |
|
349 expectedmatch = Array('a'); |
|
350 addThis(); |
|
351 |
|
352 status = inSection(40); |
|
353 pattern = /\ba\b/; |
|
354 string = '-a'; |
|
355 actualmatch = string.match(pattern); |
|
356 expectedmatch = Array('a'); |
|
357 addThis(); |
|
358 |
|
359 status = inSection(41); |
|
360 pattern = /\ba\b/; |
|
361 string = '-a-'; |
|
362 actualmatch = string.match(pattern); |
|
363 expectedmatch = Array('a'); |
|
364 addThis(); |
|
365 |
|
366 status = inSection(42); |
|
367 pattern = /\By\b/; |
|
368 string = 'xy'; |
|
369 actualmatch = string.match(pattern); |
|
370 expectedmatch = Array('y'); |
|
371 addThis(); |
|
372 |
|
373 status = inSection(43); |
|
374 pattern = /\by\B/; |
|
375 string = 'yz'; |
|
376 actualmatch = string.match(pattern); |
|
377 expectedmatch = Array('y'); |
|
378 addThis(); |
|
379 |
|
380 status = inSection(44); |
|
381 pattern = /\By\B/; |
|
382 string = 'xyz'; |
|
383 actualmatch = string.match(pattern); |
|
384 expectedmatch = Array('y'); |
|
385 addThis(); |
|
386 |
|
387 status = inSection(45); |
|
388 pattern = /\w/; |
|
389 string = 'a'; |
|
390 actualmatch = string.match(pattern); |
|
391 expectedmatch = Array('a'); |
|
392 addThis(); |
|
393 |
|
394 status = inSection(46); |
|
395 pattern = /\W/; |
|
396 string = '-'; |
|
397 actualmatch = string.match(pattern); |
|
398 expectedmatch = Array('-'); |
|
399 addThis(); |
|
400 |
|
401 status = inSection(47); |
|
402 pattern = /a\Sb/; |
|
403 string = 'a-b'; |
|
404 actualmatch = string.match(pattern); |
|
405 expectedmatch = Array('a-b'); |
|
406 addThis(); |
|
407 |
|
408 status = inSection(48); |
|
409 pattern = /\d/; |
|
410 string = '1'; |
|
411 actualmatch = string.match(pattern); |
|
412 expectedmatch = Array('1'); |
|
413 addThis(); |
|
414 |
|
415 status = inSection(49); |
|
416 pattern = /\D/; |
|
417 string = '-'; |
|
418 actualmatch = string.match(pattern); |
|
419 expectedmatch = Array('-'); |
|
420 addThis(); |
|
421 |
|
422 status = inSection(50); |
|
423 pattern = /[\w]/; |
|
424 string = 'a'; |
|
425 actualmatch = string.match(pattern); |
|
426 expectedmatch = Array('a'); |
|
427 addThis(); |
|
428 |
|
429 status = inSection(51); |
|
430 pattern = /[\W]/; |
|
431 string = '-'; |
|
432 actualmatch = string.match(pattern); |
|
433 expectedmatch = Array('-'); |
|
434 addThis(); |
|
435 |
|
436 status = inSection(52); |
|
437 pattern = /a[\S]b/; |
|
438 string = 'a-b'; |
|
439 actualmatch = string.match(pattern); |
|
440 expectedmatch = Array('a-b'); |
|
441 addThis(); |
|
442 |
|
443 status = inSection(53); |
|
444 pattern = /[\d]/; |
|
445 string = '1'; |
|
446 actualmatch = string.match(pattern); |
|
447 expectedmatch = Array('1'); |
|
448 addThis(); |
|
449 |
|
450 status = inSection(54); |
|
451 pattern = /[\D]/; |
|
452 string = '-'; |
|
453 actualmatch = string.match(pattern); |
|
454 expectedmatch = Array('-'); |
|
455 addThis(); |
|
456 |
|
457 status = inSection(55); |
|
458 pattern = /ab|cd/; |
|
459 string = 'abc'; |
|
460 actualmatch = string.match(pattern); |
|
461 expectedmatch = Array('ab'); |
|
462 addThis(); |
|
463 |
|
464 status = inSection(56); |
|
465 pattern = /ab|cd/; |
|
466 string = 'abcd'; |
|
467 actualmatch = string.match(pattern); |
|
468 expectedmatch = Array('ab'); |
|
469 addThis(); |
|
470 |
|
471 status = inSection(57); |
|
472 pattern = /()ef/; |
|
473 string = 'def'; |
|
474 actualmatch = string.match(pattern); |
|
475 expectedmatch = Array('ef', ''); |
|
476 addThis(); |
|
477 |
|
478 status = inSection(58); |
|
479 pattern = /a\(b/; |
|
480 string = 'a(b'; |
|
481 actualmatch = string.match(pattern); |
|
482 expectedmatch = Array('a(b'); |
|
483 addThis(); |
|
484 |
|
485 status = inSection(59); |
|
486 pattern = /a\(*b/; |
|
487 string = 'ab'; |
|
488 actualmatch = string.match(pattern); |
|
489 expectedmatch = Array('ab'); |
|
490 addThis(); |
|
491 |
|
492 status = inSection(60); |
|
493 pattern = /a\(*b/; |
|
494 string = 'a((b'; |
|
495 actualmatch = string.match(pattern); |
|
496 expectedmatch = Array('a((b'); |
|
497 addThis(); |
|
498 |
|
499 status = inSection(61); |
|
500 pattern = /a\\b/; |
|
501 string = 'a\\b'; |
|
502 actualmatch = string.match(pattern); |
|
503 expectedmatch = Array('a\\b'); |
|
504 addThis(); |
|
505 |
|
506 status = inSection(62); |
|
507 pattern = /((a))/; |
|
508 string = 'abc'; |
|
509 actualmatch = string.match(pattern); |
|
510 expectedmatch = Array('a', 'a', 'a'); |
|
511 addThis(); |
|
512 |
|
513 status = inSection(63); |
|
514 pattern = /(a)b(c)/; |
|
515 string = 'abc'; |
|
516 actualmatch = string.match(pattern); |
|
517 expectedmatch = Array('abc', 'a', 'c'); |
|
518 addThis(); |
|
519 |
|
520 status = inSection(64); |
|
521 pattern = /a+b+c/; |
|
522 string = 'aabbabc'; |
|
523 actualmatch = string.match(pattern); |
|
524 expectedmatch = Array('abc'); |
|
525 addThis(); |
|
526 |
|
527 status = inSection(65); |
|
528 pattern = /a{1,}b{1,}c/; |
|
529 string = 'aabbabc'; |
|
530 actualmatch = string.match(pattern); |
|
531 expectedmatch = Array('abc'); |
|
532 addThis(); |
|
533 |
|
534 status = inSection(66); |
|
535 pattern = /a.+?c/; |
|
536 string = 'abcabc'; |
|
537 actualmatch = string.match(pattern); |
|
538 expectedmatch = Array('abc'); |
|
539 addThis(); |
|
540 |
|
541 status = inSection(67); |
|
542 pattern = /(a+|b)*/; |
|
543 string = 'ab'; |
|
544 actualmatch = string.match(pattern); |
|
545 expectedmatch = Array('ab', 'b'); |
|
546 addThis(); |
|
547 |
|
548 status = inSection(68); |
|
549 pattern = /(a+|b){0,}/; |
|
550 string = 'ab'; |
|
551 actualmatch = string.match(pattern); |
|
552 expectedmatch = Array('ab', 'b'); |
|
553 addThis(); |
|
554 |
|
555 status = inSection(69); |
|
556 pattern = /(a+|b)+/; |
|
557 string = 'ab'; |
|
558 actualmatch = string.match(pattern); |
|
559 expectedmatch = Array('ab', 'b'); |
|
560 addThis(); |
|
561 |
|
562 status = inSection(70); |
|
563 pattern = /(a+|b){1,}/; |
|
564 string = 'ab'; |
|
565 actualmatch = string.match(pattern); |
|
566 expectedmatch = Array('ab', 'b'); |
|
567 addThis(); |
|
568 |
|
569 status = inSection(71); |
|
570 pattern = /(a+|b)?/; |
|
571 string = 'ab'; |
|
572 actualmatch = string.match(pattern); |
|
573 expectedmatch = Array('a', 'a'); |
|
574 addThis(); |
|
575 |
|
576 status = inSection(72); |
|
577 pattern = /(a+|b){0,1}/; |
|
578 string = 'ab'; |
|
579 actualmatch = string.match(pattern); |
|
580 expectedmatch = Array('a', 'a'); |
|
581 addThis(); |
|
582 |
|
583 status = inSection(73); |
|
584 pattern = /[^ab]*/; |
|
585 string = 'cde'; |
|
586 actualmatch = string.match(pattern); |
|
587 expectedmatch = Array('cde'); |
|
588 addThis(); |
|
589 |
|
590 status = inSection(74); |
|
591 pattern = /([abc])*d/; |
|
592 string = 'abbbcd'; |
|
593 actualmatch = string.match(pattern); |
|
594 expectedmatch = Array('abbbcd', 'c'); |
|
595 addThis(); |
|
596 |
|
597 status = inSection(75); |
|
598 pattern = /([abc])*bcd/; |
|
599 string = 'abcd'; |
|
600 actualmatch = string.match(pattern); |
|
601 expectedmatch = Array('abcd', 'a'); |
|
602 addThis(); |
|
603 |
|
604 status = inSection(76); |
|
605 pattern = /a|b|c|d|e/; |
|
606 string = 'e'; |
|
607 actualmatch = string.match(pattern); |
|
608 expectedmatch = Array('e'); |
|
609 addThis(); |
|
610 |
|
611 status = inSection(77); |
|
612 pattern = /(a|b|c|d|e)f/; |
|
613 string = 'ef'; |
|
614 actualmatch = string.match(pattern); |
|
615 expectedmatch = Array('ef', 'e'); |
|
616 addThis(); |
|
617 |
|
618 status = inSection(78); |
|
619 pattern = /abcd*efg/; |
|
620 string = 'abcdefg'; |
|
621 actualmatch = string.match(pattern); |
|
622 expectedmatch = Array('abcdefg'); |
|
623 addThis(); |
|
624 |
|
625 status = inSection(79); |
|
626 pattern = /ab*/; |
|
627 string = 'xabyabbbz'; |
|
628 actualmatch = string.match(pattern); |
|
629 expectedmatch = Array('ab'); |
|
630 addThis(); |
|
631 |
|
632 status = inSection(80); |
|
633 pattern = /ab*/; |
|
634 string = 'xayabbbz'; |
|
635 actualmatch = string.match(pattern); |
|
636 expectedmatch = Array('a'); |
|
637 addThis(); |
|
638 |
|
639 status = inSection(81); |
|
640 pattern = /(ab|cd)e/; |
|
641 string = 'abcde'; |
|
642 actualmatch = string.match(pattern); |
|
643 expectedmatch = Array('cde', 'cd'); |
|
644 addThis(); |
|
645 |
|
646 status = inSection(82); |
|
647 pattern = /[abhgefdc]ij/; |
|
648 string = 'hij'; |
|
649 actualmatch = string.match(pattern); |
|
650 expectedmatch = Array('hij'); |
|
651 addThis(); |
|
652 |
|
653 status = inSection(83); |
|
654 pattern = /(abc|)ef/; |
|
655 string = 'abcdef'; |
|
656 actualmatch = string.match(pattern); |
|
657 expectedmatch = Array('ef', ''); |
|
658 addThis(); |
|
659 |
|
660 status = inSection(84); |
|
661 pattern = /(a|b)c*d/; |
|
662 string = 'abcd'; |
|
663 actualmatch = string.match(pattern); |
|
664 expectedmatch = Array('bcd', 'b'); |
|
665 addThis(); |
|
666 |
|
667 status = inSection(85); |
|
668 pattern = /(ab|ab*)bc/; |
|
669 string = 'abc'; |
|
670 actualmatch = string.match(pattern); |
|
671 expectedmatch = Array('abc', 'a'); |
|
672 addThis(); |
|
673 |
|
674 status = inSection(86); |
|
675 pattern = /a([bc]*)c*/; |
|
676 string = 'abc'; |
|
677 actualmatch = string.match(pattern); |
|
678 expectedmatch = Array('abc', 'bc'); |
|
679 addThis(); |
|
680 |
|
681 status = inSection(87); |
|
682 pattern = /a([bc]*)(c*d)/; |
|
683 string = 'abcd'; |
|
684 actualmatch = string.match(pattern); |
|
685 expectedmatch = Array('abcd', 'bc', 'd'); |
|
686 addThis(); |
|
687 |
|
688 status = inSection(88); |
|
689 pattern = /a([bc]+)(c*d)/; |
|
690 string = 'abcd'; |
|
691 actualmatch = string.match(pattern); |
|
692 expectedmatch = Array('abcd', 'bc', 'd'); |
|
693 addThis(); |
|
694 |
|
695 status = inSection(89); |
|
696 pattern = /a([bc]*)(c+d)/; |
|
697 string = 'abcd'; |
|
698 actualmatch = string.match(pattern); |
|
699 expectedmatch = Array('abcd', 'b', 'cd'); |
|
700 addThis(); |
|
701 |
|
702 status = inSection(90); |
|
703 pattern = /a[bcd]*dcdcde/; |
|
704 string = 'adcdcde'; |
|
705 actualmatch = string.match(pattern); |
|
706 expectedmatch = Array('adcdcde'); |
|
707 addThis(); |
|
708 |
|
709 status = inSection(91); |
|
710 pattern = /(ab|a)b*c/; |
|
711 string = 'abc'; |
|
712 actualmatch = string.match(pattern); |
|
713 expectedmatch = Array('abc', 'ab'); |
|
714 addThis(); |
|
715 |
|
716 status = inSection(92); |
|
717 pattern = /((a)(b)c)(d)/; |
|
718 string = 'abcd'; |
|
719 actualmatch = string.match(pattern); |
|
720 expectedmatch = Array('abcd', 'abc', 'a', 'b', 'd'); |
|
721 addThis(); |
|
722 |
|
723 status = inSection(93); |
|
724 pattern = /[a-zA-Z_][a-zA-Z0-9_]*/; |
|
725 string = 'alpha'; |
|
726 actualmatch = string.match(pattern); |
|
727 expectedmatch = Array('alpha'); |
|
728 addThis(); |
|
729 |
|
730 status = inSection(94); |
|
731 pattern = /^a(bc+|b[eh])g|.h$/; |
|
732 string = 'abh'; |
|
733 actualmatch = string.match(pattern); |
|
734 expectedmatch = Array('bh', undefined); |
|
735 addThis(); |
|
736 |
|
737 status = inSection(95); |
|
738 pattern = /(bc+d$|ef*g.|h?i(j|k))/; |
|
739 string = 'effgz'; |
|
740 actualmatch = string.match(pattern); |
|
741 expectedmatch = Array('effgz', 'effgz', undefined); |
|
742 addThis(); |
|
743 |
|
744 status = inSection(96); |
|
745 pattern = /(bc+d$|ef*g.|h?i(j|k))/; |
|
746 string = 'ij'; |
|
747 actualmatch = string.match(pattern); |
|
748 expectedmatch = Array('ij', 'ij', 'j'); |
|
749 addThis(); |
|
750 |
|
751 status = inSection(97); |
|
752 pattern = /(bc+d$|ef*g.|h?i(j|k))/; |
|
753 string = 'reffgz'; |
|
754 actualmatch = string.match(pattern); |
|
755 expectedmatch = Array('effgz', 'effgz', undefined); |
|
756 addThis(); |
|
757 |
|
758 status = inSection(98); |
|
759 pattern = /((((((((((a))))))))))/; |
|
760 string = 'a'; |
|
761 actualmatch = string.match(pattern); |
|
762 expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); |
|
763 addThis(); |
|
764 |
|
765 status = inSection(99); |
|
766 pattern = /((((((((((a))))))))))\10/; |
|
767 string = 'aa'; |
|
768 actualmatch = string.match(pattern); |
|
769 expectedmatch = Array('aa', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); |
|
770 addThis(); |
|
771 |
|
772 status = inSection(100); |
|
773 pattern = /((((((((((a))))))))))/; |
|
774 string = 'a!'; |
|
775 actualmatch = string.match(pattern); |
|
776 expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); |
|
777 addThis(); |
|
778 |
|
779 status = inSection(101); |
|
780 pattern = /(((((((((a)))))))))/; |
|
781 string = 'a'; |
|
782 actualmatch = string.match(pattern); |
|
783 expectedmatch = Array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'); |
|
784 addThis(); |
|
785 |
|
786 status = inSection(102); |
|
787 pattern = /(.*)c(.*)/; |
|
788 string = 'abcde'; |
|
789 actualmatch = string.match(pattern); |
|
790 expectedmatch = Array('abcde', 'ab', 'de'); |
|
791 addThis(); |
|
792 |
|
793 status = inSection(103); |
|
794 pattern = /abcd/; |
|
795 string = 'abcd'; |
|
796 actualmatch = string.match(pattern); |
|
797 expectedmatch = Array('abcd'); |
|
798 addThis(); |
|
799 |
|
800 status = inSection(104); |
|
801 pattern = /a(bc)d/; |
|
802 string = 'abcd'; |
|
803 actualmatch = string.match(pattern); |
|
804 expectedmatch = Array('abcd', 'bc'); |
|
805 addThis(); |
|
806 |
|
807 status = inSection(105); |
|
808 pattern = /a[-]?c/; |
|
809 string = 'ac'; |
|
810 actualmatch = string.match(pattern); |
|
811 expectedmatch = Array('ac'); |
|
812 addThis(); |
|
813 |
|
814 status = inSection(106); |
|
815 pattern = /(abc)\1/; |
|
816 string = 'abcabc'; |
|
817 actualmatch = string.match(pattern); |
|
818 expectedmatch = Array('abcabc', 'abc'); |
|
819 addThis(); |
|
820 |
|
821 status = inSection(107); |
|
822 pattern = /([a-c]*)\1/; |
|
823 string = 'abcabc'; |
|
824 actualmatch = string.match(pattern); |
|
825 expectedmatch = Array('abcabc', 'abc'); |
|
826 addThis(); |
|
827 |
|
828 status = inSection(108); |
|
829 pattern = /(a)|\1/; |
|
830 string = 'a'; |
|
831 actualmatch = string.match(pattern); |
|
832 expectedmatch = Array('a', 'a'); |
|
833 addThis(); |
|
834 |
|
835 status = inSection(109); |
|
836 pattern = /(([a-c])b*?\2)*/; |
|
837 string = 'ababbbcbc'; |
|
838 actualmatch = string.match(pattern); |
|
839 expectedmatch = Array('ababb', 'bb', 'b'); |
|
840 addThis(); |
|
841 |
|
842 status = inSection(110); |
|
843 pattern = /(([a-c])b*?\2){3}/; |
|
844 string = 'ababbbcbc'; |
|
845 actualmatch = string.match(pattern); |
|
846 expectedmatch = Array('ababbbcbc', 'cbc', 'c'); |
|
847 addThis(); |
|
848 |
|
849 /* Can't refer to a capture before it's encountered & completed |
|
850 status = inSection(111); |
|
851 pattern = /((\3|b)\2(a)x)+/; |
|
852 string = 'aaaxabaxbaaxbbax'; |
|
853 actualmatch = string.match(pattern); |
|
854 expectedmatch = Array('bbax', 'bbax', 'b', 'a'); |
|
855 addThis(); |
|
856 |
|
857 status = inSection(112); |
|
858 pattern = /((\3|b)\2(a)){2,}/; |
|
859 string = 'bbaababbabaaaaabbaaaabba'; |
|
860 actualmatch = string.match(pattern); |
|
861 expectedmatch = Array('bbaaaabba', 'bba', 'b', 'a'); |
|
862 addThis(); |
|
863 */ |
|
864 |
|
865 status = inSection(113); |
|
866 pattern = /abc/i; |
|
867 string = 'ABC'; |
|
868 actualmatch = string.match(pattern); |
|
869 expectedmatch = Array('ABC'); |
|
870 addThis(); |
|
871 |
|
872 status = inSection(114); |
|
873 pattern = /abc/i; |
|
874 string = 'XABCY'; |
|
875 actualmatch = string.match(pattern); |
|
876 expectedmatch = Array('ABC'); |
|
877 addThis(); |
|
878 |
|
879 status = inSection(115); |
|
880 pattern = /abc/i; |
|
881 string = 'ABABC'; |
|
882 actualmatch = string.match(pattern); |
|
883 expectedmatch = Array('ABC'); |
|
884 addThis(); |
|
885 |
|
886 status = inSection(116); |
|
887 pattern = /ab*c/i; |
|
888 string = 'ABC'; |
|
889 actualmatch = string.match(pattern); |
|
890 expectedmatch = Array('ABC'); |
|
891 addThis(); |
|
892 |
|
893 status = inSection(117); |
|
894 pattern = /ab*bc/i; |
|
895 string = 'ABC'; |
|
896 actualmatch = string.match(pattern); |
|
897 expectedmatch = Array('ABC'); |
|
898 addThis(); |
|
899 |
|
900 status = inSection(118); |
|
901 pattern = /ab*bc/i; |
|
902 string = 'ABBC'; |
|
903 actualmatch = string.match(pattern); |
|
904 expectedmatch = Array('ABBC'); |
|
905 addThis(); |
|
906 |
|
907 status = inSection(119); |
|
908 pattern = /ab*?bc/i; |
|
909 string = 'ABBBBC'; |
|
910 actualmatch = string.match(pattern); |
|
911 expectedmatch = Array('ABBBBC'); |
|
912 addThis(); |
|
913 |
|
914 status = inSection(120); |
|
915 pattern = /ab{0,}?bc/i; |
|
916 string = 'ABBBBC'; |
|
917 actualmatch = string.match(pattern); |
|
918 expectedmatch = Array('ABBBBC'); |
|
919 addThis(); |
|
920 |
|
921 status = inSection(121); |
|
922 pattern = /ab+?bc/i; |
|
923 string = 'ABBC'; |
|
924 actualmatch = string.match(pattern); |
|
925 expectedmatch = Array('ABBC'); |
|
926 addThis(); |
|
927 |
|
928 status = inSection(122); |
|
929 pattern = /ab+bc/i; |
|
930 string = 'ABBBBC'; |
|
931 actualmatch = string.match(pattern); |
|
932 expectedmatch = Array('ABBBBC'); |
|
933 addThis(); |
|
934 |
|
935 status = inSection(123); |
|
936 pattern = /ab{1,}?bc/i; |
|
937 string = 'ABBBBC'; |
|
938 actualmatch = string.match(pattern); |
|
939 expectedmatch = Array('ABBBBC'); |
|
940 addThis(); |
|
941 |
|
942 status = inSection(124); |
|
943 pattern = /ab{1,3}?bc/i; |
|
944 string = 'ABBBBC'; |
|
945 actualmatch = string.match(pattern); |
|
946 expectedmatch = Array('ABBBBC'); |
|
947 addThis(); |
|
948 |
|
949 status = inSection(125); |
|
950 pattern = /ab{3,4}?bc/i; |
|
951 string = 'ABBBBC'; |
|
952 actualmatch = string.match(pattern); |
|
953 expectedmatch = Array('ABBBBC'); |
|
954 addThis(); |
|
955 |
|
956 status = inSection(126); |
|
957 pattern = /ab??bc/i; |
|
958 string = 'ABBC'; |
|
959 actualmatch = string.match(pattern); |
|
960 expectedmatch = Array('ABBC'); |
|
961 addThis(); |
|
962 |
|
963 status = inSection(127); |
|
964 pattern = /ab??bc/i; |
|
965 string = 'ABC'; |
|
966 actualmatch = string.match(pattern); |
|
967 expectedmatch = Array('ABC'); |
|
968 addThis(); |
|
969 |
|
970 status = inSection(128); |
|
971 pattern = /ab{0,1}?bc/i; |
|
972 string = 'ABC'; |
|
973 actualmatch = string.match(pattern); |
|
974 expectedmatch = Array('ABC'); |
|
975 addThis(); |
|
976 |
|
977 status = inSection(129); |
|
978 pattern = /ab??c/i; |
|
979 string = 'ABC'; |
|
980 actualmatch = string.match(pattern); |
|
981 expectedmatch = Array('ABC'); |
|
982 addThis(); |
|
983 |
|
984 status = inSection(130); |
|
985 pattern = /ab{0,1}?c/i; |
|
986 string = 'ABC'; |
|
987 actualmatch = string.match(pattern); |
|
988 expectedmatch = Array('ABC'); |
|
989 addThis(); |
|
990 |
|
991 status = inSection(131); |
|
992 pattern = /^abc$/i; |
|
993 string = 'ABC'; |
|
994 actualmatch = string.match(pattern); |
|
995 expectedmatch = Array('ABC'); |
|
996 addThis(); |
|
997 |
|
998 status = inSection(132); |
|
999 pattern = /^abc/i; |
|
1000 string = 'ABCC'; |
|
1001 actualmatch = string.match(pattern); |
|
1002 expectedmatch = Array('ABC'); |
|
1003 addThis(); |
|
1004 |
|
1005 status = inSection(133); |
|
1006 pattern = /abc$/i; |
|
1007 string = 'AABC'; |
|
1008 actualmatch = string.match(pattern); |
|
1009 expectedmatch = Array('ABC'); |
|
1010 addThis(); |
|
1011 |
|
1012 status = inSection(134); |
|
1013 pattern = /^/i; |
|
1014 string = 'ABC'; |
|
1015 actualmatch = string.match(pattern); |
|
1016 expectedmatch = Array(''); |
|
1017 addThis(); |
|
1018 |
|
1019 status = inSection(135); |
|
1020 pattern = /$/i; |
|
1021 string = 'ABC'; |
|
1022 actualmatch = string.match(pattern); |
|
1023 expectedmatch = Array(''); |
|
1024 addThis(); |
|
1025 |
|
1026 status = inSection(136); |
|
1027 pattern = /a.c/i; |
|
1028 string = 'ABC'; |
|
1029 actualmatch = string.match(pattern); |
|
1030 expectedmatch = Array('ABC'); |
|
1031 addThis(); |
|
1032 |
|
1033 status = inSection(137); |
|
1034 pattern = /a.c/i; |
|
1035 string = 'AXC'; |
|
1036 actualmatch = string.match(pattern); |
|
1037 expectedmatch = Array('AXC'); |
|
1038 addThis(); |
|
1039 |
|
1040 status = inSection(138); |
|
1041 pattern = /a.*?c/i; |
|
1042 string = 'AXYZC'; |
|
1043 actualmatch = string.match(pattern); |
|
1044 expectedmatch = Array('AXYZC'); |
|
1045 addThis(); |
|
1046 |
|
1047 status = inSection(139); |
|
1048 pattern = /a[bc]d/i; |
|
1049 string = 'ABD'; |
|
1050 actualmatch = string.match(pattern); |
|
1051 expectedmatch = Array('ABD'); |
|
1052 addThis(); |
|
1053 |
|
1054 status = inSection(140); |
|
1055 pattern = /a[b-d]e/i; |
|
1056 string = 'ACE'; |
|
1057 actualmatch = string.match(pattern); |
|
1058 expectedmatch = Array('ACE'); |
|
1059 addThis(); |
|
1060 |
|
1061 status = inSection(141); |
|
1062 pattern = /a[b-d]/i; |
|
1063 string = 'AAC'; |
|
1064 actualmatch = string.match(pattern); |
|
1065 expectedmatch = Array('AC'); |
|
1066 addThis(); |
|
1067 |
|
1068 status = inSection(142); |
|
1069 pattern = /a[-b]/i; |
|
1070 string = 'A-'; |
|
1071 actualmatch = string.match(pattern); |
|
1072 expectedmatch = Array('A-'); |
|
1073 addThis(); |
|
1074 |
|
1075 status = inSection(143); |
|
1076 pattern = /a[b-]/i; |
|
1077 string = 'A-'; |
|
1078 actualmatch = string.match(pattern); |
|
1079 expectedmatch = Array('A-'); |
|
1080 addThis(); |
|
1081 |
|
1082 status = inSection(144); |
|
1083 pattern = /a]/i; |
|
1084 string = 'A]'; |
|
1085 actualmatch = string.match(pattern); |
|
1086 expectedmatch = Array('A]'); |
|
1087 addThis(); |
|
1088 |
|
1089 /* Perl supports ] & ^] inside a [], ECMA does not |
|
1090 status = inSection(145); |
|
1091 pattern = /a[]]b/i; |
|
1092 string = 'A]B'; |
|
1093 actualmatch = string.match(pattern); |
|
1094 expectedmatch = Array('A]B'); |
|
1095 addThis(); |
|
1096 */ |
|
1097 |
|
1098 status = inSection(146); |
|
1099 pattern = /a[^bc]d/i; |
|
1100 string = 'AED'; |
|
1101 actualmatch = string.match(pattern); |
|
1102 expectedmatch = Array('AED'); |
|
1103 addThis(); |
|
1104 |
|
1105 status = inSection(147); |
|
1106 pattern = /a[^-b]c/i; |
|
1107 string = 'ADC'; |
|
1108 actualmatch = string.match(pattern); |
|
1109 expectedmatch = Array('ADC'); |
|
1110 addThis(); |
|
1111 |
|
1112 /* Perl supports ] & ^] inside a [], ECMA does not |
|
1113 status = inSection(148); |
|
1114 pattern = /a[^]b]c/i; |
|
1115 string = 'ADC'; |
|
1116 actualmatch = string.match(pattern); |
|
1117 expectedmatch = Array('ADC'); |
|
1118 addThis(); |
|
1119 */ |
|
1120 |
|
1121 status = inSection(149); |
|
1122 pattern = /ab|cd/i; |
|
1123 string = 'ABC'; |
|
1124 actualmatch = string.match(pattern); |
|
1125 expectedmatch = Array('AB'); |
|
1126 addThis(); |
|
1127 |
|
1128 status = inSection(150); |
|
1129 pattern = /ab|cd/i; |
|
1130 string = 'ABCD'; |
|
1131 actualmatch = string.match(pattern); |
|
1132 expectedmatch = Array('AB'); |
|
1133 addThis(); |
|
1134 |
|
1135 status = inSection(151); |
|
1136 pattern = /()ef/i; |
|
1137 string = 'DEF'; |
|
1138 actualmatch = string.match(pattern); |
|
1139 expectedmatch = Array('EF', ''); |
|
1140 addThis(); |
|
1141 |
|
1142 status = inSection(152); |
|
1143 pattern = /a\(b/i; |
|
1144 string = 'A(B'; |
|
1145 actualmatch = string.match(pattern); |
|
1146 expectedmatch = Array('A(B'); |
|
1147 addThis(); |
|
1148 |
|
1149 status = inSection(153); |
|
1150 pattern = /a\(*b/i; |
|
1151 string = 'AB'; |
|
1152 actualmatch = string.match(pattern); |
|
1153 expectedmatch = Array('AB'); |
|
1154 addThis(); |
|
1155 |
|
1156 status = inSection(154); |
|
1157 pattern = /a\(*b/i; |
|
1158 string = 'A((B'; |
|
1159 actualmatch = string.match(pattern); |
|
1160 expectedmatch = Array('A((B'); |
|
1161 addThis(); |
|
1162 |
|
1163 status = inSection(155); |
|
1164 pattern = /a\\b/i; |
|
1165 string = 'A\\B'; |
|
1166 actualmatch = string.match(pattern); |
|
1167 expectedmatch = Array('A\\B'); |
|
1168 addThis(); |
|
1169 |
|
1170 status = inSection(156); |
|
1171 pattern = /((a))/i; |
|
1172 string = 'ABC'; |
|
1173 actualmatch = string.match(pattern); |
|
1174 expectedmatch = Array('A', 'A', 'A'); |
|
1175 addThis(); |
|
1176 |
|
1177 status = inSection(157); |
|
1178 pattern = /(a)b(c)/i; |
|
1179 string = 'ABC'; |
|
1180 actualmatch = string.match(pattern); |
|
1181 expectedmatch = Array('ABC', 'A', 'C'); |
|
1182 addThis(); |
|
1183 |
|
1184 status = inSection(158); |
|
1185 pattern = /a+b+c/i; |
|
1186 string = 'AABBABC'; |
|
1187 actualmatch = string.match(pattern); |
|
1188 expectedmatch = Array('ABC'); |
|
1189 addThis(); |
|
1190 |
|
1191 status = inSection(159); |
|
1192 pattern = /a{1,}b{1,}c/i; |
|
1193 string = 'AABBABC'; |
|
1194 actualmatch = string.match(pattern); |
|
1195 expectedmatch = Array('ABC'); |
|
1196 addThis(); |
|
1197 |
|
1198 status = inSection(160); |
|
1199 pattern = /a.+?c/i; |
|
1200 string = 'ABCABC'; |
|
1201 actualmatch = string.match(pattern); |
|
1202 expectedmatch = Array('ABC'); |
|
1203 addThis(); |
|
1204 |
|
1205 status = inSection(161); |
|
1206 pattern = /a.*?c/i; |
|
1207 string = 'ABCABC'; |
|
1208 actualmatch = string.match(pattern); |
|
1209 expectedmatch = Array('ABC'); |
|
1210 addThis(); |
|
1211 |
|
1212 status = inSection(162); |
|
1213 pattern = /a.{0,5}?c/i; |
|
1214 string = 'ABCABC'; |
|
1215 actualmatch = string.match(pattern); |
|
1216 expectedmatch = Array('ABC'); |
|
1217 addThis(); |
|
1218 |
|
1219 status = inSection(163); |
|
1220 pattern = /(a+|b)*/i; |
|
1221 string = 'AB'; |
|
1222 actualmatch = string.match(pattern); |
|
1223 expectedmatch = Array('AB', 'B'); |
|
1224 addThis(); |
|
1225 |
|
1226 status = inSection(164); |
|
1227 pattern = /(a+|b){0,}/i; |
|
1228 string = 'AB'; |
|
1229 actualmatch = string.match(pattern); |
|
1230 expectedmatch = Array('AB', 'B'); |
|
1231 addThis(); |
|
1232 |
|
1233 status = inSection(165); |
|
1234 pattern = /(a+|b)+/i; |
|
1235 string = 'AB'; |
|
1236 actualmatch = string.match(pattern); |
|
1237 expectedmatch = Array('AB', 'B'); |
|
1238 addThis(); |
|
1239 |
|
1240 status = inSection(166); |
|
1241 pattern = /(a+|b){1,}/i; |
|
1242 string = 'AB'; |
|
1243 actualmatch = string.match(pattern); |
|
1244 expectedmatch = Array('AB', 'B'); |
|
1245 addThis(); |
|
1246 |
|
1247 status = inSection(167); |
|
1248 pattern = /(a+|b)?/i; |
|
1249 string = 'AB'; |
|
1250 actualmatch = string.match(pattern); |
|
1251 expectedmatch = Array('A', 'A'); |
|
1252 addThis(); |
|
1253 |
|
1254 status = inSection(168); |
|
1255 pattern = /(a+|b){0,1}/i; |
|
1256 string = 'AB'; |
|
1257 actualmatch = string.match(pattern); |
|
1258 expectedmatch = Array('A', 'A'); |
|
1259 addThis(); |
|
1260 |
|
1261 status = inSection(169); |
|
1262 pattern = /(a+|b){0,1}?/i; |
|
1263 string = 'AB'; |
|
1264 actualmatch = string.match(pattern); |
|
1265 expectedmatch = Array('', undefined); |
|
1266 addThis(); |
|
1267 |
|
1268 status = inSection(170); |
|
1269 pattern = /[^ab]*/i; |
|
1270 string = 'CDE'; |
|
1271 actualmatch = string.match(pattern); |
|
1272 expectedmatch = Array('CDE'); |
|
1273 addThis(); |
|
1274 |
|
1275 status = inSection(171); |
|
1276 pattern = /([abc])*d/i; |
|
1277 string = 'ABBBCD'; |
|
1278 actualmatch = string.match(pattern); |
|
1279 expectedmatch = Array('ABBBCD', 'C'); |
|
1280 addThis(); |
|
1281 |
|
1282 status = inSection(172); |
|
1283 pattern = /([abc])*bcd/i; |
|
1284 string = 'ABCD'; |
|
1285 actualmatch = string.match(pattern); |
|
1286 expectedmatch = Array('ABCD', 'A'); |
|
1287 addThis(); |
|
1288 |
|
1289 status = inSection(173); |
|
1290 pattern = /a|b|c|d|e/i; |
|
1291 string = 'E'; |
|
1292 actualmatch = string.match(pattern); |
|
1293 expectedmatch = Array('E'); |
|
1294 addThis(); |
|
1295 |
|
1296 status = inSection(174); |
|
1297 pattern = /(a|b|c|d|e)f/i; |
|
1298 string = 'EF'; |
|
1299 actualmatch = string.match(pattern); |
|
1300 expectedmatch = Array('EF', 'E'); |
|
1301 addThis(); |
|
1302 |
|
1303 status = inSection(175); |
|
1304 pattern = /abcd*efg/i; |
|
1305 string = 'ABCDEFG'; |
|
1306 actualmatch = string.match(pattern); |
|
1307 expectedmatch = Array('ABCDEFG'); |
|
1308 addThis(); |
|
1309 |
|
1310 status = inSection(176); |
|
1311 pattern = /ab*/i; |
|
1312 string = 'XABYABBBZ'; |
|
1313 actualmatch = string.match(pattern); |
|
1314 expectedmatch = Array('AB'); |
|
1315 addThis(); |
|
1316 |
|
1317 status = inSection(177); |
|
1318 pattern = /ab*/i; |
|
1319 string = 'XAYABBBZ'; |
|
1320 actualmatch = string.match(pattern); |
|
1321 expectedmatch = Array('A'); |
|
1322 addThis(); |
|
1323 |
|
1324 status = inSection(178); |
|
1325 pattern = /(ab|cd)e/i; |
|
1326 string = 'ABCDE'; |
|
1327 actualmatch = string.match(pattern); |
|
1328 expectedmatch = Array('CDE', 'CD'); |
|
1329 addThis(); |
|
1330 |
|
1331 status = inSection(179); |
|
1332 pattern = /[abhgefdc]ij/i; |
|
1333 string = 'HIJ'; |
|
1334 actualmatch = string.match(pattern); |
|
1335 expectedmatch = Array('HIJ'); |
|
1336 addThis(); |
|
1337 |
|
1338 status = inSection(180); |
|
1339 pattern = /(abc|)ef/i; |
|
1340 string = 'ABCDEF'; |
|
1341 actualmatch = string.match(pattern); |
|
1342 expectedmatch = Array('EF', ''); |
|
1343 addThis(); |
|
1344 |
|
1345 status = inSection(181); |
|
1346 pattern = /(a|b)c*d/i; |
|
1347 string = 'ABCD'; |
|
1348 actualmatch = string.match(pattern); |
|
1349 expectedmatch = Array('BCD', 'B'); |
|
1350 addThis(); |
|
1351 |
|
1352 status = inSection(182); |
|
1353 pattern = /(ab|ab*)bc/i; |
|
1354 string = 'ABC'; |
|
1355 actualmatch = string.match(pattern); |
|
1356 expectedmatch = Array('ABC', 'A'); |
|
1357 addThis(); |
|
1358 |
|
1359 status = inSection(183); |
|
1360 pattern = /a([bc]*)c*/i; |
|
1361 string = 'ABC'; |
|
1362 actualmatch = string.match(pattern); |
|
1363 expectedmatch = Array('ABC', 'BC'); |
|
1364 addThis(); |
|
1365 |
|
1366 status = inSection(184); |
|
1367 pattern = /a([bc]*)(c*d)/i; |
|
1368 string = 'ABCD'; |
|
1369 actualmatch = string.match(pattern); |
|
1370 expectedmatch = Array('ABCD', 'BC', 'D'); |
|
1371 addThis(); |
|
1372 |
|
1373 status = inSection(185); |
|
1374 pattern = /a([bc]+)(c*d)/i; |
|
1375 string = 'ABCD'; |
|
1376 actualmatch = string.match(pattern); |
|
1377 expectedmatch = Array('ABCD', 'BC', 'D'); |
|
1378 addThis(); |
|
1379 |
|
1380 status = inSection(186); |
|
1381 pattern = /a([bc]*)(c+d)/i; |
|
1382 string = 'ABCD'; |
|
1383 actualmatch = string.match(pattern); |
|
1384 expectedmatch = Array('ABCD', 'B', 'CD'); |
|
1385 addThis(); |
|
1386 |
|
1387 status = inSection(187); |
|
1388 pattern = /a[bcd]*dcdcde/i; |
|
1389 string = 'ADCDCDE'; |
|
1390 actualmatch = string.match(pattern); |
|
1391 expectedmatch = Array('ADCDCDE'); |
|
1392 addThis(); |
|
1393 |
|
1394 status = inSection(188); |
|
1395 pattern = /(ab|a)b*c/i; |
|
1396 string = 'ABC'; |
|
1397 actualmatch = string.match(pattern); |
|
1398 expectedmatch = Array('ABC', 'AB'); |
|
1399 addThis(); |
|
1400 |
|
1401 status = inSection(189); |
|
1402 pattern = /((a)(b)c)(d)/i; |
|
1403 string = 'ABCD'; |
|
1404 actualmatch = string.match(pattern); |
|
1405 expectedmatch = Array('ABCD', 'ABC', 'A', 'B', 'D'); |
|
1406 addThis(); |
|
1407 |
|
1408 status = inSection(190); |
|
1409 pattern = /[a-zA-Z_][a-zA-Z0-9_]*/i; |
|
1410 string = 'ALPHA'; |
|
1411 actualmatch = string.match(pattern); |
|
1412 expectedmatch = Array('ALPHA'); |
|
1413 addThis(); |
|
1414 |
|
1415 status = inSection(191); |
|
1416 pattern = /^a(bc+|b[eh])g|.h$/i; |
|
1417 string = 'ABH'; |
|
1418 actualmatch = string.match(pattern); |
|
1419 expectedmatch = Array('BH', undefined); |
|
1420 addThis(); |
|
1421 |
|
1422 status = inSection(192); |
|
1423 pattern = /(bc+d$|ef*g.|h?i(j|k))/i; |
|
1424 string = 'EFFGZ'; |
|
1425 actualmatch = string.match(pattern); |
|
1426 expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); |
|
1427 addThis(); |
|
1428 |
|
1429 status = inSection(193); |
|
1430 pattern = /(bc+d$|ef*g.|h?i(j|k))/i; |
|
1431 string = 'IJ'; |
|
1432 actualmatch = string.match(pattern); |
|
1433 expectedmatch = Array('IJ', 'IJ', 'J'); |
|
1434 addThis(); |
|
1435 |
|
1436 status = inSection(194); |
|
1437 pattern = /(bc+d$|ef*g.|h?i(j|k))/i; |
|
1438 string = 'REFFGZ'; |
|
1439 actualmatch = string.match(pattern); |
|
1440 expectedmatch = Array('EFFGZ', 'EFFGZ', undefined); |
|
1441 addThis(); |
|
1442 |
|
1443 status = inSection(195); |
|
1444 pattern = /((((((((((a))))))))))/i; |
|
1445 string = 'A'; |
|
1446 actualmatch = string.match(pattern); |
|
1447 expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); |
|
1448 addThis(); |
|
1449 |
|
1450 status = inSection(196); |
|
1451 pattern = /((((((((((a))))))))))\10/i; |
|
1452 string = 'AA'; |
|
1453 actualmatch = string.match(pattern); |
|
1454 expectedmatch = Array('AA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); |
|
1455 addThis(); |
|
1456 |
|
1457 status = inSection(197); |
|
1458 pattern = /((((((((((a))))))))))/i; |
|
1459 string = 'A!'; |
|
1460 actualmatch = string.match(pattern); |
|
1461 expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); |
|
1462 addThis(); |
|
1463 |
|
1464 status = inSection(198); |
|
1465 pattern = /(((((((((a)))))))))/i; |
|
1466 string = 'A'; |
|
1467 actualmatch = string.match(pattern); |
|
1468 expectedmatch = Array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'); |
|
1469 addThis(); |
|
1470 |
|
1471 status = inSection(199); |
|
1472 pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i; |
|
1473 string = 'A'; |
|
1474 actualmatch = string.match(pattern); |
|
1475 expectedmatch = Array('A', 'A'); |
|
1476 addThis(); |
|
1477 |
|
1478 status = inSection(200); |
|
1479 pattern = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i; |
|
1480 string = 'C'; |
|
1481 actualmatch = string.match(pattern); |
|
1482 expectedmatch = Array('C', 'C'); |
|
1483 addThis(); |
|
1484 |
|
1485 status = inSection(201); |
|
1486 pattern = /(.*)c(.*)/i; |
|
1487 string = 'ABCDE'; |
|
1488 actualmatch = string.match(pattern); |
|
1489 expectedmatch = Array('ABCDE', 'AB', 'DE'); |
|
1490 addThis(); |
|
1491 |
|
1492 status = inSection(202); |
|
1493 pattern = /abcd/i; |
|
1494 string = 'ABCD'; |
|
1495 actualmatch = string.match(pattern); |
|
1496 expectedmatch = Array('ABCD'); |
|
1497 addThis(); |
|
1498 |
|
1499 status = inSection(203); |
|
1500 pattern = /a(bc)d/i; |
|
1501 string = 'ABCD'; |
|
1502 actualmatch = string.match(pattern); |
|
1503 expectedmatch = Array('ABCD', 'BC'); |
|
1504 addThis(); |
|
1505 |
|
1506 status = inSection(204); |
|
1507 pattern = /a[-]?c/i; |
|
1508 string = 'AC'; |
|
1509 actualmatch = string.match(pattern); |
|
1510 expectedmatch = Array('AC'); |
|
1511 addThis(); |
|
1512 |
|
1513 status = inSection(205); |
|
1514 pattern = /(abc)\1/i; |
|
1515 string = 'ABCABC'; |
|
1516 actualmatch = string.match(pattern); |
|
1517 expectedmatch = Array('ABCABC', 'ABC'); |
|
1518 addThis(); |
|
1519 |
|
1520 status = inSection(206); |
|
1521 pattern = /([a-c]*)\1/i; |
|
1522 string = 'ABCABC'; |
|
1523 actualmatch = string.match(pattern); |
|
1524 expectedmatch = Array('ABCABC', 'ABC'); |
|
1525 addThis(); |
|
1526 |
|
1527 status = inSection(207); |
|
1528 pattern = /a(?!b)./; |
|
1529 string = 'abad'; |
|
1530 actualmatch = string.match(pattern); |
|
1531 expectedmatch = Array('ad'); |
|
1532 addThis(); |
|
1533 |
|
1534 status = inSection(208); |
|
1535 pattern = /a(?=d)./; |
|
1536 string = 'abad'; |
|
1537 actualmatch = string.match(pattern); |
|
1538 expectedmatch = Array('ad'); |
|
1539 addThis(); |
|
1540 |
|
1541 status = inSection(209); |
|
1542 pattern = /a(?=c|d)./; |
|
1543 string = 'abad'; |
|
1544 actualmatch = string.match(pattern); |
|
1545 expectedmatch = Array('ad'); |
|
1546 addThis(); |
|
1547 |
|
1548 status = inSection(210); |
|
1549 pattern = /a(?:b|c|d)(.)/; |
|
1550 string = 'ace'; |
|
1551 actualmatch = string.match(pattern); |
|
1552 expectedmatch = Array('ace', 'e'); |
|
1553 addThis(); |
|
1554 |
|
1555 status = inSection(211); |
|
1556 pattern = /a(?:b|c|d)*(.)/; |
|
1557 string = 'ace'; |
|
1558 actualmatch = string.match(pattern); |
|
1559 expectedmatch = Array('ace', 'e'); |
|
1560 addThis(); |
|
1561 |
|
1562 status = inSection(212); |
|
1563 pattern = /a(?:b|c|d)+?(.)/; |
|
1564 string = 'ace'; |
|
1565 actualmatch = string.match(pattern); |
|
1566 expectedmatch = Array('ace', 'e'); |
|
1567 addThis(); |
|
1568 |
|
1569 status = inSection(213); |
|
1570 pattern = /a(?:b|c|d)+?(.)/; |
|
1571 string = 'acdbcdbe'; |
|
1572 actualmatch = string.match(pattern); |
|
1573 expectedmatch = Array('acd', 'd'); |
|
1574 addThis(); |
|
1575 |
|
1576 status = inSection(214); |
|
1577 pattern = /a(?:b|c|d)+(.)/; |
|
1578 string = 'acdbcdbe'; |
|
1579 actualmatch = string.match(pattern); |
|
1580 expectedmatch = Array('acdbcdbe', 'e'); |
|
1581 addThis(); |
|
1582 |
|
1583 status = inSection(215); |
|
1584 pattern = /a(?:b|c|d){2}(.)/; |
|
1585 string = 'acdbcdbe'; |
|
1586 actualmatch = string.match(pattern); |
|
1587 expectedmatch = Array('acdb', 'b'); |
|
1588 addThis(); |
|
1589 |
|
1590 status = inSection(216); |
|
1591 pattern = /a(?:b|c|d){4,5}(.)/; |
|
1592 string = 'acdbcdbe'; |
|
1593 actualmatch = string.match(pattern); |
|
1594 expectedmatch = Array('acdbcdb', 'b'); |
|
1595 addThis(); |
|
1596 |
|
1597 status = inSection(217); |
|
1598 pattern = /a(?:b|c|d){4,5}?(.)/; |
|
1599 string = 'acdbcdbe'; |
|
1600 actualmatch = string.match(pattern); |
|
1601 expectedmatch = Array('acdbcd', 'd'); |
|
1602 addThis(); |
|
1603 |
|
1604 // MODIFIED - ECMA has different rules for paren contents |
|
1605 status = inSection(218); |
|
1606 pattern = /((foo)|(bar))*/; |
|
1607 string = 'foobar'; |
|
1608 actualmatch = string.match(pattern); |
|
1609 //expectedmatch = Array('foobar', 'bar', 'foo', 'bar'); |
|
1610 expectedmatch = Array('foobar', 'bar', undefined, 'bar'); |
|
1611 addThis(); |
|
1612 |
|
1613 status = inSection(219); |
|
1614 pattern = /a(?:b|c|d){6,7}(.)/; |
|
1615 string = 'acdbcdbe'; |
|
1616 actualmatch = string.match(pattern); |
|
1617 expectedmatch = Array('acdbcdbe', 'e'); |
|
1618 addThis(); |
|
1619 |
|
1620 status = inSection(220); |
|
1621 pattern = /a(?:b|c|d){6,7}?(.)/; |
|
1622 string = 'acdbcdbe'; |
|
1623 actualmatch = string.match(pattern); |
|
1624 expectedmatch = Array('acdbcdbe', 'e'); |
|
1625 addThis(); |
|
1626 |
|
1627 status = inSection(221); |
|
1628 pattern = /a(?:b|c|d){5,6}(.)/; |
|
1629 string = 'acdbcdbe'; |
|
1630 actualmatch = string.match(pattern); |
|
1631 expectedmatch = Array('acdbcdbe', 'e'); |
|
1632 addThis(); |
|
1633 |
|
1634 status = inSection(222); |
|
1635 pattern = /a(?:b|c|d){5,6}?(.)/; |
|
1636 string = 'acdbcdbe'; |
|
1637 actualmatch = string.match(pattern); |
|
1638 expectedmatch = Array('acdbcdb', 'b'); |
|
1639 addThis(); |
|
1640 |
|
1641 status = inSection(223); |
|
1642 pattern = /a(?:b|c|d){5,7}(.)/; |
|
1643 string = 'acdbcdbe'; |
|
1644 actualmatch = string.match(pattern); |
|
1645 expectedmatch = Array('acdbcdbe', 'e'); |
|
1646 addThis(); |
|
1647 |
|
1648 status = inSection(224); |
|
1649 pattern = /a(?:b|c|d){5,7}?(.)/; |
|
1650 string = 'acdbcdbe'; |
|
1651 actualmatch = string.match(pattern); |
|
1652 expectedmatch = Array('acdbcdb', 'b'); |
|
1653 addThis(); |
|
1654 |
|
1655 status = inSection(225); |
|
1656 pattern = /a(?:b|(c|e){1,2}?|d)+?(.)/; |
|
1657 string = 'ace'; |
|
1658 actualmatch = string.match(pattern); |
|
1659 expectedmatch = Array('ace', 'c', 'e'); |
|
1660 addThis(); |
|
1661 |
|
1662 status = inSection(226); |
|
1663 pattern = /^(.+)?B/; |
|
1664 string = 'AB'; |
|
1665 actualmatch = string.match(pattern); |
|
1666 expectedmatch = Array('AB', 'A'); |
|
1667 addThis(); |
|
1668 |
|
1669 /* MODIFIED - ECMA has different rules for paren contents */ |
|
1670 status = inSection(227); |
|
1671 pattern = /^([^a-z])|(\^)$/; |
|
1672 string = '.'; |
|
1673 actualmatch = string.match(pattern); |
|
1674 //expectedmatch = Array('.', '.', ''); |
|
1675 expectedmatch = Array('.', '.', undefined); |
|
1676 addThis(); |
|
1677 |
|
1678 status = inSection(228); |
|
1679 pattern = /^[<>]&/; |
|
1680 string = '<&OUT'; |
|
1681 actualmatch = string.match(pattern); |
|
1682 expectedmatch = Array('<&'); |
|
1683 addThis(); |
|
1684 |
|
1685 /* Can't refer to a capture before it's encountered & completed |
|
1686 status = inSection(229); |
|
1687 pattern = /^(a\1?){4}$/; |
|
1688 string = 'aaaaaaaaaa'; |
|
1689 actualmatch = string.match(pattern); |
|
1690 expectedmatch = Array('aaaaaaaaaa', 'aaaa'); |
|
1691 addThis(); |
|
1692 |
|
1693 status = inSection(230); |
|
1694 pattern = /^(a(?(1)\1)){4}$/; |
|
1695 string = 'aaaaaaaaaa'; |
|
1696 actualmatch = string.match(pattern); |
|
1697 expectedmatch = Array('aaaaaaaaaa', 'aaaa'); |
|
1698 addThis(); |
|
1699 */ |
|
1700 |
|
1701 status = inSection(231); |
|
1702 pattern = /((a{4})+)/; |
|
1703 string = 'aaaaaaaaa'; |
|
1704 actualmatch = string.match(pattern); |
|
1705 expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa'); |
|
1706 addThis(); |
|
1707 |
|
1708 status = inSection(232); |
|
1709 pattern = /(((aa){2})+)/; |
|
1710 string = 'aaaaaaaaaa'; |
|
1711 actualmatch = string.match(pattern); |
|
1712 expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); |
|
1713 addThis(); |
|
1714 |
|
1715 status = inSection(233); |
|
1716 pattern = /(((a{2}){2})+)/; |
|
1717 string = 'aaaaaaaaaa'; |
|
1718 actualmatch = string.match(pattern); |
|
1719 expectedmatch = Array('aaaaaaaa', 'aaaaaaaa', 'aaaa', 'aa'); |
|
1720 addThis(); |
|
1721 |
|
1722 status = inSection(234); |
|
1723 pattern = /(?:(f)(o)(o)|(b)(a)(r))*/; |
|
1724 string = 'foobar'; |
|
1725 actualmatch = string.match(pattern); |
|
1726 //expectedmatch = Array('foobar', 'f', 'o', 'o', 'b', 'a', 'r'); |
|
1727 expectedmatch = Array('foobar', undefined, undefined, undefined, 'b', 'a', 'r'); |
|
1728 addThis(); |
|
1729 |
|
1730 /* ECMA supports (?: (?= and (?! but doesn't support (?< etc. |
|
1731 status = inSection(235); |
|
1732 pattern = /(?<=a)b/; |
|
1733 string = 'ab'; |
|
1734 actualmatch = string.match(pattern); |
|
1735 expectedmatch = Array('b'); |
|
1736 addThis(); |
|
1737 |
|
1738 status = inSection(236); |
|
1739 pattern = /(?<!c)b/; |
|
1740 string = 'ab'; |
|
1741 actualmatch = string.match(pattern); |
|
1742 expectedmatch = Array('b'); |
|
1743 addThis(); |
|
1744 |
|
1745 status = inSection(237); |
|
1746 pattern = /(?<!c)b/; |
|
1747 string = 'b'; |
|
1748 actualmatch = string.match(pattern); |
|
1749 expectedmatch = Array('b'); |
|
1750 addThis(); |
|
1751 |
|
1752 status = inSection(238); |
|
1753 pattern = /(?<!c)b/; |
|
1754 string = 'b'; |
|
1755 actualmatch = string.match(pattern); |
|
1756 expectedmatch = Array('b'); |
|
1757 addThis(); |
|
1758 */ |
|
1759 |
|
1760 status = inSection(239); |
|
1761 pattern = /(?:..)*a/; |
|
1762 string = 'aba'; |
|
1763 actualmatch = string.match(pattern); |
|
1764 expectedmatch = Array('aba'); |
|
1765 addThis(); |
|
1766 |
|
1767 status = inSection(240); |
|
1768 pattern = /(?:..)*?a/; |
|
1769 string = 'aba'; |
|
1770 actualmatch = string.match(pattern); |
|
1771 expectedmatch = Array('a'); |
|
1772 addThis(); |
|
1773 |
|
1774 /* |
|
1775 * MODIFIED - ECMA has different rules for paren contents. Note |
|
1776 * this regexp has two non-capturing parens, and one capturing |
|
1777 * |
|
1778 * The issue: shouldn't the match be ['ab', undefined]? Because the |
|
1779 * '\1' matches the undefined value of the second iteration of the '*' |
|
1780 * (in which the 'b' part of the '|' matches). But Perl wants ['ab','b']. |
|
1781 * |
|
1782 * Answer: waldemar@netscape.com: |
|
1783 * |
|
1784 * The correct answer is ['ab', undefined]. Perl doesn't match |
|
1785 * ECMAScript here, and I'd say that Perl is wrong in this case. |
|
1786 */ |
|
1787 status = inSection(241); |
|
1788 pattern = /^(?:b|a(?=(.)))*\1/; |
|
1789 string = 'abc'; |
|
1790 actualmatch = string.match(pattern); |
|
1791 //expectedmatch = Array('ab', 'b'); |
|
1792 expectedmatch = Array('ab', undefined); |
|
1793 addThis(); |
|
1794 |
|
1795 status = inSection(242); |
|
1796 pattern = /^(){3,5}/; |
|
1797 string = 'abc'; |
|
1798 actualmatch = string.match(pattern); |
|
1799 expectedmatch = Array('', ''); |
|
1800 addThis(); |
|
1801 |
|
1802 status = inSection(243); |
|
1803 pattern = /^(a+)*ax/; |
|
1804 string = 'aax'; |
|
1805 actualmatch = string.match(pattern); |
|
1806 expectedmatch = Array('aax', 'a'); |
|
1807 addThis(); |
|
1808 |
|
1809 status = inSection(244); |
|
1810 pattern = /^((a|b)+)*ax/; |
|
1811 string = 'aax'; |
|
1812 actualmatch = string.match(pattern); |
|
1813 expectedmatch = Array('aax', 'a', 'a'); |
|
1814 addThis(); |
|
1815 |
|
1816 status = inSection(245); |
|
1817 pattern = /^((a|bc)+)*ax/; |
|
1818 string = 'aax'; |
|
1819 actualmatch = string.match(pattern); |
|
1820 expectedmatch = Array('aax', 'a', 'a'); |
|
1821 addThis(); |
|
1822 |
|
1823 /* MODIFIED - ECMA has different rules for paren contents */ |
|
1824 status = inSection(246); |
|
1825 pattern = /(a|x)*ab/; |
|
1826 string = 'cab'; |
|
1827 actualmatch = string.match(pattern); |
|
1828 //expectedmatch = Array('ab', ''); |
|
1829 expectedmatch = Array('ab', undefined); |
|
1830 addThis(); |
|
1831 |
|
1832 status = inSection(247); |
|
1833 pattern = /(a)*ab/; |
|
1834 string = 'cab'; |
|
1835 actualmatch = string.match(pattern); |
|
1836 expectedmatch = Array('ab', undefined); |
|
1837 addThis(); |
|
1838 |
|
1839 /* ECMA doesn't support (?imsx or (?-imsx |
|
1840 status = inSection(248); |
|
1841 pattern = /(?:(?i)a)b/; |
|
1842 string = 'ab'; |
|
1843 actualmatch = string.match(pattern); |
|
1844 expectedmatch = Array('ab'); |
|
1845 addThis(); |
|
1846 |
|
1847 status = inSection(249); |
|
1848 pattern = /((?i)a)b/; |
|
1849 string = 'ab'; |
|
1850 actualmatch = string.match(pattern); |
|
1851 expectedmatch = Array('ab', 'a'); |
|
1852 addThis(); |
|
1853 |
|
1854 status = inSection(250); |
|
1855 pattern = /(?:(?i)a)b/; |
|
1856 string = 'Ab'; |
|
1857 actualmatch = string.match(pattern); |
|
1858 expectedmatch = Array('Ab'); |
|
1859 addThis(); |
|
1860 |
|
1861 status = inSection(251); |
|
1862 pattern = /((?i)a)b/; |
|
1863 string = 'Ab'; |
|
1864 actualmatch = string.match(pattern); |
|
1865 expectedmatch = Array('Ab', 'A'); |
|
1866 addThis(); |
|
1867 |
|
1868 status = inSection(252); |
|
1869 pattern = /(?i:a)b/; |
|
1870 string = 'ab'; |
|
1871 actualmatch = string.match(pattern); |
|
1872 expectedmatch = Array('ab'); |
|
1873 addThis(); |
|
1874 |
|
1875 status = inSection(253); |
|
1876 pattern = /((?i:a))b/; |
|
1877 string = 'ab'; |
|
1878 actualmatch = string.match(pattern); |
|
1879 expectedmatch = Array('ab', 'a'); |
|
1880 addThis(); |
|
1881 |
|
1882 status = inSection(254); |
|
1883 pattern = /(?i:a)b/; |
|
1884 string = 'Ab'; |
|
1885 actualmatch = string.match(pattern); |
|
1886 expectedmatch = Array('Ab'); |
|
1887 addThis(); |
|
1888 |
|
1889 status = inSection(255); |
|
1890 pattern = /((?i:a))b/; |
|
1891 string = 'Ab'; |
|
1892 actualmatch = string.match(pattern); |
|
1893 expectedmatch = Array('Ab', 'A'); |
|
1894 addThis(); |
|
1895 |
|
1896 status = inSection(256); |
|
1897 pattern = /(?:(?-i)a)b/i; |
|
1898 string = 'ab'; |
|
1899 actualmatch = string.match(pattern); |
|
1900 expectedmatch = Array('ab'); |
|
1901 addThis(); |
|
1902 |
|
1903 status = inSection(257); |
|
1904 pattern = /((?-i)a)b/i; |
|
1905 string = 'ab'; |
|
1906 actualmatch = string.match(pattern); |
|
1907 expectedmatch = Array('ab', 'a'); |
|
1908 addThis(); |
|
1909 |
|
1910 status = inSection(258); |
|
1911 pattern = /(?:(?-i)a)b/i; |
|
1912 string = 'aB'; |
|
1913 actualmatch = string.match(pattern); |
|
1914 expectedmatch = Array('aB'); |
|
1915 addThis(); |
|
1916 |
|
1917 status = inSection(259); |
|
1918 pattern = /((?-i)a)b/i; |
|
1919 string = 'aB'; |
|
1920 actualmatch = string.match(pattern); |
|
1921 expectedmatch = Array('aB', 'a'); |
|
1922 addThis(); |
|
1923 |
|
1924 status = inSection(260); |
|
1925 pattern = /(?:(?-i)a)b/i; |
|
1926 string = 'aB'; |
|
1927 actualmatch = string.match(pattern); |
|
1928 expectedmatch = Array('aB'); |
|
1929 addThis(); |
|
1930 |
|
1931 status = inSection(261); |
|
1932 pattern = /((?-i)a)b/i; |
|
1933 string = 'aB'; |
|
1934 actualmatch = string.match(pattern); |
|
1935 expectedmatch = Array('aB', 'a'); |
|
1936 addThis(); |
|
1937 |
|
1938 status = inSection(262); |
|
1939 pattern = /(?-i:a)b/i; |
|
1940 string = 'ab'; |
|
1941 actualmatch = string.match(pattern); |
|
1942 expectedmatch = Array('ab'); |
|
1943 addThis(); |
|
1944 |
|
1945 status = inSection(263); |
|
1946 pattern = /((?-i:a))b/i; |
|
1947 string = 'ab'; |
|
1948 actualmatch = string.match(pattern); |
|
1949 expectedmatch = Array('ab', 'a'); |
|
1950 addThis(); |
|
1951 |
|
1952 status = inSection(264); |
|
1953 pattern = /(?-i:a)b/i; |
|
1954 string = 'aB'; |
|
1955 actualmatch = string.match(pattern); |
|
1956 expectedmatch = Array('aB'); |
|
1957 addThis(); |
|
1958 |
|
1959 status = inSection(265); |
|
1960 pattern = /((?-i:a))b/i; |
|
1961 string = 'aB'; |
|
1962 actualmatch = string.match(pattern); |
|
1963 expectedmatch = Array('aB', 'a'); |
|
1964 addThis(); |
|
1965 |
|
1966 status = inSection(266); |
|
1967 pattern = /(?-i:a)b/i; |
|
1968 string = 'aB'; |
|
1969 actualmatch = string.match(pattern); |
|
1970 expectedmatch = Array('aB'); |
|
1971 addThis(); |
|
1972 |
|
1973 status = inSection(267); |
|
1974 pattern = /((?-i:a))b/i; |
|
1975 string = 'aB'; |
|
1976 actualmatch = string.match(pattern); |
|
1977 expectedmatch = Array('aB', 'a'); |
|
1978 addThis(); |
|
1979 |
|
1980 status = inSection(268); |
|
1981 pattern = /((?s-i:a.))b/i; |
|
1982 string = 'a\nB'; |
|
1983 actualmatch = string.match(pattern); |
|
1984 expectedmatch = Array('a\nB', 'a\n'); |
|
1985 addThis(); |
|
1986 */ |
|
1987 |
|
1988 status = inSection(269); |
|
1989 pattern = /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/; |
|
1990 string = 'cabbbb'; |
|
1991 actualmatch = string.match(pattern); |
|
1992 expectedmatch = Array('cabbbb'); |
|
1993 addThis(); |
|
1994 |
|
1995 status = inSection(270); |
|
1996 pattern = /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/; |
|
1997 string = 'caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'; |
|
1998 actualmatch = string.match(pattern); |
|
1999 expectedmatch = Array('caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); |
|
2000 addThis(); |
|
2001 |
|
2002 status = inSection(271); |
|
2003 pattern = /(ab)\d\1/i; |
|
2004 string = 'Ab4ab'; |
|
2005 actualmatch = string.match(pattern); |
|
2006 expectedmatch = Array('Ab4ab', 'Ab'); |
|
2007 addThis(); |
|
2008 |
|
2009 status = inSection(272); |
|
2010 pattern = /(ab)\d\1/i; |
|
2011 string = 'ab4Ab'; |
|
2012 actualmatch = string.match(pattern); |
|
2013 expectedmatch = Array('ab4Ab', 'ab'); |
|
2014 addThis(); |
|
2015 |
|
2016 status = inSection(273); |
|
2017 pattern = /foo\w*\d{4}baz/; |
|
2018 string = 'foobar1234baz'; |
|
2019 actualmatch = string.match(pattern); |
|
2020 expectedmatch = Array('foobar1234baz'); |
|
2021 addThis(); |
|
2022 |
|
2023 status = inSection(274); |
|
2024 pattern = /x(~~)*(?:(?:F)?)?/; |
|
2025 string = 'x~~'; |
|
2026 actualmatch = string.match(pattern); |
|
2027 expectedmatch = Array('x~~', '~~'); |
|
2028 addThis(); |
|
2029 |
|
2030 /* Perl supports (?# but JS doesn't |
|
2031 status = inSection(275); |
|
2032 pattern = /^a(?#xxx){3}c/; |
|
2033 string = 'aaac'; |
|
2034 actualmatch = string.match(pattern); |
|
2035 expectedmatch = Array('aaac'); |
|
2036 addThis(); |
|
2037 */ |
|
2038 |
|
2039 /* ECMA doesn't support (?< etc |
|
2040 status = inSection(276); |
|
2041 pattern = /(?<![cd])[ab]/; |
|
2042 string = 'dbaacb'; |
|
2043 actualmatch = string.match(pattern); |
|
2044 expectedmatch = Array('a'); |
|
2045 addThis(); |
|
2046 |
|
2047 status = inSection(277); |
|
2048 pattern = /(?<!(c|d))[ab]/; |
|
2049 string = 'dbaacb'; |
|
2050 actualmatch = string.match(pattern); |
|
2051 expectedmatch = Array('a'); |
|
2052 addThis(); |
|
2053 |
|
2054 status = inSection(278); |
|
2055 pattern = /(?<!cd)[ab]/; |
|
2056 string = 'cdaccb'; |
|
2057 actualmatch = string.match(pattern); |
|
2058 expectedmatch = Array('b'); |
|
2059 addThis(); |
|
2060 |
|
2061 status = inSection(279); |
|
2062 pattern = /((?s)^a(.))((?m)^b$)/; |
|
2063 string = 'a\nb\nc\n'; |
|
2064 actualmatch = string.match(pattern); |
|
2065 expectedmatch = Array('a\nb', 'a\n', '\n', 'b'); |
|
2066 addThis(); |
|
2067 |
|
2068 status = inSection(280); |
|
2069 pattern = /((?m)^b$)/; |
|
2070 string = 'a\nb\nc\n'; |
|
2071 actualmatch = string.match(pattern); |
|
2072 expectedmatch = Array('b', 'b'); |
|
2073 addThis(); |
|
2074 |
|
2075 status = inSection(281); |
|
2076 pattern = /(?m)^b/; |
|
2077 string = 'a\nb\n'; |
|
2078 actualmatch = string.match(pattern); |
|
2079 expectedmatch = Array('b'); |
|
2080 addThis(); |
|
2081 |
|
2082 status = inSection(282); |
|
2083 pattern = /(?m)^(b)/; |
|
2084 string = 'a\nb\n'; |
|
2085 actualmatch = string.match(pattern); |
|
2086 expectedmatch = Array('b', 'b'); |
|
2087 addThis(); |
|
2088 |
|
2089 status = inSection(283); |
|
2090 pattern = /((?m)^b)/; |
|
2091 string = 'a\nb\n'; |
|
2092 actualmatch = string.match(pattern); |
|
2093 expectedmatch = Array('b', 'b'); |
|
2094 addThis(); |
|
2095 |
|
2096 status = inSection(284); |
|
2097 pattern = /\n((?m)^b)/; |
|
2098 string = 'a\nb\n'; |
|
2099 actualmatch = string.match(pattern); |
|
2100 expectedmatch = Array('\nb', 'b'); |
|
2101 addThis(); |
|
2102 |
|
2103 status = inSection(285); |
|
2104 pattern = /((?s).)c(?!.)/; |
|
2105 string = 'a\nb\nc\n'; |
|
2106 actualmatch = string.match(pattern); |
|
2107 expectedmatch = Array('\nc', '\n'); |
|
2108 addThis(); |
|
2109 |
|
2110 status = inSection(286); |
|
2111 pattern = /((?s).)c(?!.)/; |
|
2112 string = 'a\nb\nc\n'; |
|
2113 actualmatch = string.match(pattern); |
|
2114 expectedmatch = Array('\nc', '\n'); |
|
2115 addThis(); |
|
2116 |
|
2117 status = inSection(287); |
|
2118 pattern = /((?s)b.)c(?!.)/; |
|
2119 string = 'a\nb\nc\n'; |
|
2120 actualmatch = string.match(pattern); |
|
2121 expectedmatch = Array('b\nc', 'b\n'); |
|
2122 addThis(); |
|
2123 |
|
2124 status = inSection(288); |
|
2125 pattern = /((?s)b.)c(?!.)/; |
|
2126 string = 'a\nb\nc\n'; |
|
2127 actualmatch = string.match(pattern); |
|
2128 expectedmatch = Array('b\nc', 'b\n'); |
|
2129 addThis(); |
|
2130 |
|
2131 status = inSection(289); |
|
2132 pattern = /((?m)^b)/; |
|
2133 string = 'a\nb\nc\n'; |
|
2134 actualmatch = string.match(pattern); |
|
2135 expectedmatch = Array('b', 'b'); |
|
2136 addThis(); |
|
2137 */ |
|
2138 |
|
2139 /* ECMA doesn't support (?(condition) |
|
2140 status = inSection(290); |
|
2141 pattern = /(?(1)b|a)/; |
|
2142 string = 'a'; |
|
2143 actualmatch = string.match(pattern); |
|
2144 expectedmatch = Array('a'); |
|
2145 addThis(); |
|
2146 |
|
2147 status = inSection(291); |
|
2148 pattern = /(x)?(?(1)b|a)/; |
|
2149 string = 'a'; |
|
2150 actualmatch = string.match(pattern); |
|
2151 expectedmatch = Array('a'); |
|
2152 addThis(); |
|
2153 |
|
2154 status = inSection(292); |
|
2155 pattern = /()?(?(1)b|a)/; |
|
2156 string = 'a'; |
|
2157 actualmatch = string.match(pattern); |
|
2158 expectedmatch = Array('a'); |
|
2159 addThis(); |
|
2160 |
|
2161 status = inSection(293); |
|
2162 pattern = /()?(?(1)a|b)/; |
|
2163 string = 'a'; |
|
2164 actualmatch = string.match(pattern); |
|
2165 expectedmatch = Array('a'); |
|
2166 addThis(); |
|
2167 |
|
2168 status = inSection(294); |
|
2169 pattern = /^(\()?blah(?(1)(\)))$/; |
|
2170 string = '(blah)'; |
|
2171 actualmatch = string.match(pattern); |
|
2172 expectedmatch = Array('(blah)', '(', ')'); |
|
2173 addThis(); |
|
2174 |
|
2175 status = inSection(295); |
|
2176 pattern = /^(\()?blah(?(1)(\)))$/; |
|
2177 string = 'blah'; |
|
2178 actualmatch = string.match(pattern); |
|
2179 expectedmatch = Array('blah'); |
|
2180 addThis(); |
|
2181 |
|
2182 status = inSection(296); |
|
2183 pattern = /^(\(+)?blah(?(1)(\)))$/; |
|
2184 string = '(blah)'; |
|
2185 actualmatch = string.match(pattern); |
|
2186 expectedmatch = Array('(blah)', '(', ')'); |
|
2187 addThis(); |
|
2188 |
|
2189 status = inSection(297); |
|
2190 pattern = /^(\(+)?blah(?(1)(\)))$/; |
|
2191 string = 'blah'; |
|
2192 actualmatch = string.match(pattern); |
|
2193 expectedmatch = Array('blah'); |
|
2194 addThis(); |
|
2195 |
|
2196 status = inSection(298); |
|
2197 pattern = /(?(?!a)b|a)/; |
|
2198 string = 'a'; |
|
2199 actualmatch = string.match(pattern); |
|
2200 expectedmatch = Array('a'); |
|
2201 addThis(); |
|
2202 |
|
2203 status = inSection(299); |
|
2204 pattern = /(?(?=a)a|b)/; |
|
2205 string = 'a'; |
|
2206 actualmatch = string.match(pattern); |
|
2207 expectedmatch = Array('a'); |
|
2208 addThis(); |
|
2209 */ |
|
2210 |
|
2211 status = inSection(300); |
|
2212 pattern = /(?=(a+?))(\1ab)/; |
|
2213 string = 'aaab'; |
|
2214 actualmatch = string.match(pattern); |
|
2215 expectedmatch = Array('aab', 'a', 'aab'); |
|
2216 addThis(); |
|
2217 |
|
2218 status = inSection(301); |
|
2219 pattern = /(\w+:)+/; |
|
2220 string = 'one:'; |
|
2221 actualmatch = string.match(pattern); |
|
2222 expectedmatch = Array('one:', 'one:'); |
|
2223 addThis(); |
|
2224 |
|
2225 /* ECMA doesn't support (?< etc |
|
2226 status = inSection(302); |
|
2227 pattern = /$(?<=^(a))/; |
|
2228 string = 'a'; |
|
2229 actualmatch = string.match(pattern); |
|
2230 expectedmatch = Array('', 'a'); |
|
2231 addThis(); |
|
2232 */ |
|
2233 |
|
2234 status = inSection(303); |
|
2235 pattern = /(?=(a+?))(\1ab)/; |
|
2236 string = 'aaab'; |
|
2237 actualmatch = string.match(pattern); |
|
2238 expectedmatch = Array('aab', 'a', 'aab'); |
|
2239 addThis(); |
|
2240 |
|
2241 /* MODIFIED - ECMA has different rules for paren contents */ |
|
2242 status = inSection(304); |
|
2243 pattern = /([\w:]+::)?(\w+)$/; |
|
2244 string = 'abcd'; |
|
2245 actualmatch = string.match(pattern); |
|
2246 //expectedmatch = Array('abcd', '', 'abcd'); |
|
2247 expectedmatch = Array('abcd', undefined, 'abcd'); |
|
2248 addThis(); |
|
2249 |
|
2250 status = inSection(305); |
|
2251 pattern = /([\w:]+::)?(\w+)$/; |
|
2252 string = 'xy:z:::abcd'; |
|
2253 actualmatch = string.match(pattern); |
|
2254 expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd'); |
|
2255 addThis(); |
|
2256 |
|
2257 status = inSection(306); |
|
2258 pattern = /^[^bcd]*(c+)/; |
|
2259 string = 'aexycd'; |
|
2260 actualmatch = string.match(pattern); |
|
2261 expectedmatch = Array('aexyc', 'c'); |
|
2262 addThis(); |
|
2263 |
|
2264 status = inSection(307); |
|
2265 pattern = /(a*)b+/; |
|
2266 string = 'caab'; |
|
2267 actualmatch = string.match(pattern); |
|
2268 expectedmatch = Array('aab', 'aa'); |
|
2269 addThis(); |
|
2270 |
|
2271 /* MODIFIED - ECMA has different rules for paren contents */ |
|
2272 status = inSection(308); |
|
2273 pattern = /([\w:]+::)?(\w+)$/; |
|
2274 string = 'abcd'; |
|
2275 actualmatch = string.match(pattern); |
|
2276 //expectedmatch = Array('abcd', '', 'abcd'); |
|
2277 expectedmatch = Array('abcd', undefined, 'abcd'); |
|
2278 addThis(); |
|
2279 |
|
2280 status = inSection(309); |
|
2281 pattern = /([\w:]+::)?(\w+)$/; |
|
2282 string = 'xy:z:::abcd'; |
|
2283 actualmatch = string.match(pattern); |
|
2284 expectedmatch = Array('xy:z:::abcd', 'xy:z:::', 'abcd'); |
|
2285 addThis(); |
|
2286 |
|
2287 status = inSection(310); |
|
2288 pattern = /^[^bcd]*(c+)/; |
|
2289 string = 'aexycd'; |
|
2290 actualmatch = string.match(pattern); |
|
2291 expectedmatch = Array('aexyc', 'c'); |
|
2292 addThis(); |
|
2293 |
|
2294 /* ECMA doesn't support (?> |
|
2295 status = inSection(311); |
|
2296 pattern = /(?>a+)b/; |
|
2297 string = 'aaab'; |
|
2298 actualmatch = string.match(pattern); |
|
2299 expectedmatch = Array('aaab'); |
|
2300 addThis(); |
|
2301 */ |
|
2302 |
|
2303 status = inSection(312); |
|
2304 pattern = /([[:]+)/; |
|
2305 string = 'a:[b]:'; |
|
2306 actualmatch = string.match(pattern); |
|
2307 expectedmatch = Array(':[', ':['); |
|
2308 addThis(); |
|
2309 |
|
2310 status = inSection(313); |
|
2311 pattern = /([[=]+)/; |
|
2312 string = 'a=[b]='; |
|
2313 actualmatch = string.match(pattern); |
|
2314 expectedmatch = Array('=[', '=['); |
|
2315 addThis(); |
|
2316 |
|
2317 status = inSection(314); |
|
2318 pattern = /([[.]+)/; |
|
2319 string = 'a.[b].'; |
|
2320 actualmatch = string.match(pattern); |
|
2321 expectedmatch = Array('.[', '.['); |
|
2322 addThis(); |
|
2323 |
|
2324 /* ECMA doesn't have rules for [: |
|
2325 status = inSection(315); |
|
2326 pattern = /[a[:]b[:c]/; |
|
2327 string = 'abc'; |
|
2328 actualmatch = string.match(pattern); |
|
2329 expectedmatch = Array('abc'); |
|
2330 addThis(); |
|
2331 */ |
|
2332 |
|
2333 /* ECMA doesn't support (?> |
|
2334 status = inSection(316); |
|
2335 pattern = /((?>a+)b)/; |
|
2336 string = 'aaab'; |
|
2337 actualmatch = string.match(pattern); |
|
2338 expectedmatch = Array('aaab', 'aaab'); |
|
2339 addThis(); |
|
2340 |
|
2341 status = inSection(317); |
|
2342 pattern = /(?>(a+))b/; |
|
2343 string = 'aaab'; |
|
2344 actualmatch = string.match(pattern); |
|
2345 expectedmatch = Array('aaab', 'aaa'); |
|
2346 addThis(); |
|
2347 |
|
2348 status = inSection(318); |
|
2349 pattern = /((?>[^()]+)|\([^()]*\))+/; |
|
2350 string = '((abc(ade)ufh()()x'; |
|
2351 actualmatch = string.match(pattern); |
|
2352 expectedmatch = Array('abc(ade)ufh()()x', 'x'); |
|
2353 addThis(); |
|
2354 */ |
|
2355 |
|
2356 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2357 status = inSection(319); |
|
2358 pattern = /\Z/; |
|
2359 string = 'a\nb\n'; |
|
2360 actualmatch = string.match(pattern); |
|
2361 expectedmatch = Array(''); |
|
2362 addThis(); |
|
2363 |
|
2364 status = inSection(320); |
|
2365 pattern = /\z/; |
|
2366 string = 'a\nb\n'; |
|
2367 actualmatch = string.match(pattern); |
|
2368 expectedmatch = Array(''); |
|
2369 addThis(); |
|
2370 */ |
|
2371 |
|
2372 status = inSection(321); |
|
2373 pattern = /$/; |
|
2374 string = 'a\nb\n'; |
|
2375 actualmatch = string.match(pattern); |
|
2376 expectedmatch = Array(''); |
|
2377 addThis(); |
|
2378 |
|
2379 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2380 status = inSection(322); |
|
2381 pattern = /\Z/; |
|
2382 string = 'b\na\n'; |
|
2383 actualmatch = string.match(pattern); |
|
2384 expectedmatch = Array(''); |
|
2385 addThis(); |
|
2386 |
|
2387 status = inSection(323); |
|
2388 pattern = /\z/; |
|
2389 string = 'b\na\n'; |
|
2390 actualmatch = string.match(pattern); |
|
2391 expectedmatch = Array(''); |
|
2392 addThis(); |
|
2393 */ |
|
2394 |
|
2395 status = inSection(324); |
|
2396 pattern = /$/; |
|
2397 string = 'b\na\n'; |
|
2398 actualmatch = string.match(pattern); |
|
2399 expectedmatch = Array(''); |
|
2400 addThis(); |
|
2401 |
|
2402 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2403 status = inSection(325); |
|
2404 pattern = /\Z/; |
|
2405 string = 'b\na'; |
|
2406 actualmatch = string.match(pattern); |
|
2407 expectedmatch = Array(''); |
|
2408 addThis(); |
|
2409 |
|
2410 status = inSection(326); |
|
2411 pattern = /\z/; |
|
2412 string = 'b\na'; |
|
2413 actualmatch = string.match(pattern); |
|
2414 expectedmatch = Array(''); |
|
2415 addThis(); |
|
2416 */ |
|
2417 |
|
2418 status = inSection(327); |
|
2419 pattern = /$/; |
|
2420 string = 'b\na'; |
|
2421 actualmatch = string.match(pattern); |
|
2422 expectedmatch = Array(''); |
|
2423 addThis(); |
|
2424 |
|
2425 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2426 status = inSection(328); |
|
2427 pattern = /\Z/m; |
|
2428 string = 'a\nb\n'; |
|
2429 actualmatch = string.match(pattern); |
|
2430 expectedmatch = Array(''); |
|
2431 addThis(); |
|
2432 |
|
2433 status = inSection(329); |
|
2434 pattern = /\z/m; |
|
2435 string = 'a\nb\n'; |
|
2436 actualmatch = string.match(pattern); |
|
2437 expectedmatch = Array(''); |
|
2438 addThis(); |
|
2439 */ |
|
2440 |
|
2441 status = inSection(330); |
|
2442 pattern = /$/m; |
|
2443 string = 'a\nb\n'; |
|
2444 actualmatch = string.match(pattern); |
|
2445 expectedmatch = Array(''); |
|
2446 addThis(); |
|
2447 |
|
2448 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2449 status = inSection(331); |
|
2450 pattern = /\Z/m; |
|
2451 string = 'b\na\n'; |
|
2452 actualmatch = string.match(pattern); |
|
2453 expectedmatch = Array(''); |
|
2454 addThis(); |
|
2455 |
|
2456 status = inSection(332); |
|
2457 pattern = /\z/m; |
|
2458 string = 'b\na\n'; |
|
2459 actualmatch = string.match(pattern); |
|
2460 expectedmatch = Array(''); |
|
2461 addThis(); |
|
2462 */ |
|
2463 |
|
2464 status = inSection(333); |
|
2465 pattern = /$/m; |
|
2466 string = 'b\na\n'; |
|
2467 actualmatch = string.match(pattern); |
|
2468 expectedmatch = Array(''); |
|
2469 addThis(); |
|
2470 |
|
2471 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2472 status = inSection(334); |
|
2473 pattern = /\Z/m; |
|
2474 string = 'b\na'; |
|
2475 actualmatch = string.match(pattern); |
|
2476 expectedmatch = Array(''); |
|
2477 addThis(); |
|
2478 |
|
2479 status = inSection(335); |
|
2480 pattern = /\z/m; |
|
2481 string = 'b\na'; |
|
2482 actualmatch = string.match(pattern); |
|
2483 expectedmatch = Array(''); |
|
2484 addThis(); |
|
2485 */ |
|
2486 |
|
2487 status = inSection(336); |
|
2488 pattern = /$/m; |
|
2489 string = 'b\na'; |
|
2490 actualmatch = string.match(pattern); |
|
2491 expectedmatch = Array(''); |
|
2492 addThis(); |
|
2493 |
|
2494 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2495 status = inSection(337); |
|
2496 pattern = /a\Z/; |
|
2497 string = 'b\na\n'; |
|
2498 actualmatch = string.match(pattern); |
|
2499 expectedmatch = Array('a'); |
|
2500 addThis(); |
|
2501 */ |
|
2502 |
|
2503 /* $ only matches end of input unless multiline |
|
2504 status = inSection(338); |
|
2505 pattern = /a$/; |
|
2506 string = 'b\na\n'; |
|
2507 actualmatch = string.match(pattern); |
|
2508 expectedmatch = Array('a'); |
|
2509 addThis(); |
|
2510 */ |
|
2511 |
|
2512 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2513 status = inSection(339); |
|
2514 pattern = /a\Z/; |
|
2515 string = 'b\na'; |
|
2516 actualmatch = string.match(pattern); |
|
2517 expectedmatch = Array('a'); |
|
2518 addThis(); |
|
2519 |
|
2520 status = inSection(340); |
|
2521 pattern = /a\z/; |
|
2522 string = 'b\na'; |
|
2523 actualmatch = string.match(pattern); |
|
2524 expectedmatch = Array('a'); |
|
2525 addThis(); |
|
2526 */ |
|
2527 |
|
2528 status = inSection(341); |
|
2529 pattern = /a$/; |
|
2530 string = 'b\na'; |
|
2531 actualmatch = string.match(pattern); |
|
2532 expectedmatch = Array('a'); |
|
2533 addThis(); |
|
2534 |
|
2535 status = inSection(342); |
|
2536 pattern = /a$/m; |
|
2537 string = 'a\nb\n'; |
|
2538 actualmatch = string.match(pattern); |
|
2539 expectedmatch = Array('a'); |
|
2540 addThis(); |
|
2541 |
|
2542 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2543 status = inSection(343); |
|
2544 pattern = /a\Z/m; |
|
2545 string = 'b\na\n'; |
|
2546 actualmatch = string.match(pattern); |
|
2547 expectedmatch = Array('a'); |
|
2548 addThis(); |
|
2549 */ |
|
2550 |
|
2551 status = inSection(344); |
|
2552 pattern = /a$/m; |
|
2553 string = 'b\na\n'; |
|
2554 actualmatch = string.match(pattern); |
|
2555 expectedmatch = Array('a'); |
|
2556 addThis(); |
|
2557 |
|
2558 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2559 status = inSection(345); |
|
2560 pattern = /a\Z/m; |
|
2561 string = 'b\na'; |
|
2562 actualmatch = string.match(pattern); |
|
2563 expectedmatch = Array('a'); |
|
2564 addThis(); |
|
2565 |
|
2566 status = inSection(346); |
|
2567 pattern = /a\z/m; |
|
2568 string = 'b\na'; |
|
2569 actualmatch = string.match(pattern); |
|
2570 expectedmatch = Array('a'); |
|
2571 addThis(); |
|
2572 */ |
|
2573 |
|
2574 status = inSection(347); |
|
2575 pattern = /a$/m; |
|
2576 string = 'b\na'; |
|
2577 actualmatch = string.match(pattern); |
|
2578 expectedmatch = Array('a'); |
|
2579 addThis(); |
|
2580 |
|
2581 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2582 status = inSection(348); |
|
2583 pattern = /aa\Z/; |
|
2584 string = 'b\naa\n'; |
|
2585 actualmatch = string.match(pattern); |
|
2586 expectedmatch = Array('aa'); |
|
2587 addThis(); |
|
2588 */ |
|
2589 |
|
2590 /* $ only matches end of input unless multiline |
|
2591 status = inSection(349); |
|
2592 pattern = /aa$/; |
|
2593 string = 'b\naa\n'; |
|
2594 actualmatch = string.match(pattern); |
|
2595 expectedmatch = Array('aa'); |
|
2596 addThis(); |
|
2597 */ |
|
2598 |
|
2599 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2600 status = inSection(350); |
|
2601 pattern = /aa\Z/; |
|
2602 string = 'b\naa'; |
|
2603 actualmatch = string.match(pattern); |
|
2604 expectedmatch = Array('aa'); |
|
2605 addThis(); |
|
2606 |
|
2607 status = inSection(351); |
|
2608 pattern = /aa\z/; |
|
2609 string = 'b\naa'; |
|
2610 actualmatch = string.match(pattern); |
|
2611 expectedmatch = Array('aa'); |
|
2612 addThis(); |
|
2613 */ |
|
2614 |
|
2615 status = inSection(352); |
|
2616 pattern = /aa$/; |
|
2617 string = 'b\naa'; |
|
2618 actualmatch = string.match(pattern); |
|
2619 expectedmatch = Array('aa'); |
|
2620 addThis(); |
|
2621 |
|
2622 status = inSection(353); |
|
2623 pattern = /aa$/m; |
|
2624 string = 'aa\nb\n'; |
|
2625 actualmatch = string.match(pattern); |
|
2626 expectedmatch = Array('aa'); |
|
2627 addThis(); |
|
2628 |
|
2629 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2630 status = inSection(354); |
|
2631 pattern = /aa\Z/m; |
|
2632 string = 'b\naa\n'; |
|
2633 actualmatch = string.match(pattern); |
|
2634 expectedmatch = Array('aa'); |
|
2635 addThis(); |
|
2636 */ |
|
2637 |
|
2638 status = inSection(355); |
|
2639 pattern = /aa$/m; |
|
2640 string = 'b\naa\n'; |
|
2641 actualmatch = string.match(pattern); |
|
2642 expectedmatch = Array('aa'); |
|
2643 addThis(); |
|
2644 |
|
2645 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2646 status = inSection(356); |
|
2647 pattern = /aa\Z/m; |
|
2648 string = 'b\naa'; |
|
2649 actualmatch = string.match(pattern); |
|
2650 expectedmatch = Array('aa'); |
|
2651 addThis(); |
|
2652 |
|
2653 status = inSection(357); |
|
2654 pattern = /aa\z/m; |
|
2655 string = 'b\naa'; |
|
2656 actualmatch = string.match(pattern); |
|
2657 expectedmatch = Array('aa'); |
|
2658 addThis(); |
|
2659 */ |
|
2660 |
|
2661 status = inSection(358); |
|
2662 pattern = /aa$/m; |
|
2663 string = 'b\naa'; |
|
2664 actualmatch = string.match(pattern); |
|
2665 expectedmatch = Array('aa'); |
|
2666 addThis(); |
|
2667 |
|
2668 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2669 status = inSection(359); |
|
2670 pattern = /ab\Z/; |
|
2671 string = 'b\nab\n'; |
|
2672 actualmatch = string.match(pattern); |
|
2673 expectedmatch = Array('ab'); |
|
2674 addThis(); |
|
2675 */ |
|
2676 |
|
2677 /* $ only matches end of input unless multiline |
|
2678 status = inSection(360); |
|
2679 pattern = /ab$/; |
|
2680 string = 'b\nab\n'; |
|
2681 actualmatch = string.match(pattern); |
|
2682 expectedmatch = Array('ab'); |
|
2683 addThis(); |
|
2684 */ |
|
2685 |
|
2686 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2687 status = inSection(361); |
|
2688 pattern = /ab\Z/; |
|
2689 string = 'b\nab'; |
|
2690 actualmatch = string.match(pattern); |
|
2691 expectedmatch = Array('ab'); |
|
2692 addThis(); |
|
2693 |
|
2694 status = inSection(362); |
|
2695 pattern = /ab\z/; |
|
2696 string = 'b\nab'; |
|
2697 actualmatch = string.match(pattern); |
|
2698 expectedmatch = Array('ab'); |
|
2699 addThis(); |
|
2700 */ |
|
2701 |
|
2702 status = inSection(363); |
|
2703 pattern = /ab$/; |
|
2704 string = 'b\nab'; |
|
2705 actualmatch = string.match(pattern); |
|
2706 expectedmatch = Array('ab'); |
|
2707 addThis(); |
|
2708 |
|
2709 status = inSection(364); |
|
2710 pattern = /ab$/m; |
|
2711 string = 'ab\nb\n'; |
|
2712 actualmatch = string.match(pattern); |
|
2713 expectedmatch = Array('ab'); |
|
2714 addThis(); |
|
2715 |
|
2716 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2717 status = inSection(365); |
|
2718 pattern = /ab\Z/m; |
|
2719 string = 'b\nab\n'; |
|
2720 actualmatch = string.match(pattern); |
|
2721 expectedmatch = Array('ab'); |
|
2722 addThis(); |
|
2723 */ |
|
2724 |
|
2725 status = inSection(366); |
|
2726 pattern = /ab$/m; |
|
2727 string = 'b\nab\n'; |
|
2728 actualmatch = string.match(pattern); |
|
2729 expectedmatch = Array('ab'); |
|
2730 addThis(); |
|
2731 |
|
2732 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2733 status = inSection(367); |
|
2734 pattern = /ab\Z/m; |
|
2735 string = 'b\nab'; |
|
2736 actualmatch = string.match(pattern); |
|
2737 expectedmatch = Array('ab'); |
|
2738 addThis(); |
|
2739 |
|
2740 status = inSection(368); |
|
2741 pattern = /ab\z/m; |
|
2742 string = 'b\nab'; |
|
2743 actualmatch = string.match(pattern); |
|
2744 expectedmatch = Array('ab'); |
|
2745 addThis(); |
|
2746 */ |
|
2747 |
|
2748 status = inSection(369); |
|
2749 pattern = /ab$/m; |
|
2750 string = 'b\nab'; |
|
2751 actualmatch = string.match(pattern); |
|
2752 expectedmatch = Array('ab'); |
|
2753 addThis(); |
|
2754 |
|
2755 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2756 status = inSection(370); |
|
2757 pattern = /abb\Z/; |
|
2758 string = 'b\nabb\n'; |
|
2759 actualmatch = string.match(pattern); |
|
2760 expectedmatch = Array('abb'); |
|
2761 addThis(); |
|
2762 */ |
|
2763 |
|
2764 /* $ only matches end of input unless multiline |
|
2765 status = inSection(371); |
|
2766 pattern = /abb$/; |
|
2767 string = 'b\nabb\n'; |
|
2768 actualmatch = string.match(pattern); |
|
2769 expectedmatch = Array('abb'); |
|
2770 addThis(); |
|
2771 */ |
|
2772 |
|
2773 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2774 status = inSection(372); |
|
2775 pattern = /abb\Z/; |
|
2776 string = 'b\nabb'; |
|
2777 actualmatch = string.match(pattern); |
|
2778 expectedmatch = Array('abb'); |
|
2779 addThis(); |
|
2780 |
|
2781 status = inSection(373); |
|
2782 pattern = /abb\z/; |
|
2783 string = 'b\nabb'; |
|
2784 actualmatch = string.match(pattern); |
|
2785 expectedmatch = Array('abb'); |
|
2786 addThis(); |
|
2787 */ |
|
2788 |
|
2789 status = inSection(374); |
|
2790 pattern = /abb$/; |
|
2791 string = 'b\nabb'; |
|
2792 actualmatch = string.match(pattern); |
|
2793 expectedmatch = Array('abb'); |
|
2794 addThis(); |
|
2795 |
|
2796 status = inSection(375); |
|
2797 pattern = /abb$/m; |
|
2798 string = 'abb\nb\n'; |
|
2799 actualmatch = string.match(pattern); |
|
2800 expectedmatch = Array('abb'); |
|
2801 addThis(); |
|
2802 |
|
2803 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2804 status = inSection(376); |
|
2805 pattern = /abb\Z/m; |
|
2806 string = 'b\nabb\n'; |
|
2807 actualmatch = string.match(pattern); |
|
2808 expectedmatch = Array('abb'); |
|
2809 addThis(); |
|
2810 */ |
|
2811 |
|
2812 status = inSection(377); |
|
2813 pattern = /abb$/m; |
|
2814 string = 'b\nabb\n'; |
|
2815 actualmatch = string.match(pattern); |
|
2816 expectedmatch = Array('abb'); |
|
2817 addThis(); |
|
2818 |
|
2819 /* Perl has \Z has end-of-line, ECMA doesn't |
|
2820 status = inSection(378); |
|
2821 pattern = /abb\Z/m; |
|
2822 string = 'b\nabb'; |
|
2823 actualmatch = string.match(pattern); |
|
2824 expectedmatch = Array('abb'); |
|
2825 addThis(); |
|
2826 |
|
2827 status = inSection(379); |
|
2828 pattern = /abb\z/m; |
|
2829 string = 'b\nabb'; |
|
2830 actualmatch = string.match(pattern); |
|
2831 expectedmatch = Array('abb'); |
|
2832 addThis(); |
|
2833 */ |
|
2834 |
|
2835 status = inSection(380); |
|
2836 pattern = /abb$/m; |
|
2837 string = 'b\nabb'; |
|
2838 actualmatch = string.match(pattern); |
|
2839 expectedmatch = Array('abb'); |
|
2840 addThis(); |
|
2841 |
|
2842 status = inSection(381); |
|
2843 pattern = /(^|x)(c)/; |
|
2844 string = 'ca'; |
|
2845 actualmatch = string.match(pattern); |
|
2846 expectedmatch = Array('c', '', 'c'); |
|
2847 addThis(); |
|
2848 |
|
2849 status = inSection(382); |
|
2850 pattern = /foo.bart/; |
|
2851 string = 'foo.bart'; |
|
2852 actualmatch = string.match(pattern); |
|
2853 expectedmatch = Array('foo.bart'); |
|
2854 addThis(); |
|
2855 |
|
2856 status = inSection(383); |
|
2857 pattern = /^d[x][x][x]/m; |
|
2858 string = 'abcd\ndxxx'; |
|
2859 actualmatch = string.match(pattern); |
|
2860 expectedmatch = Array('dxxx'); |
|
2861 addThis(); |
|
2862 |
|
2863 status = inSection(384); |
|
2864 pattern = /tt+$/; |
|
2865 string = 'xxxtt'; |
|
2866 actualmatch = string.match(pattern); |
|
2867 expectedmatch = Array('tt'); |
|
2868 addThis(); |
|
2869 |
|
2870 /* ECMA spec says that each atom in a range must be a single character |
|
2871 status = inSection(385); |
|
2872 pattern = /([a-\d]+)/; |
|
2873 string = 'za-9z'; |
|
2874 actualmatch = string.match(pattern); |
|
2875 expectedmatch = Array('9', '9'); |
|
2876 addThis(); |
|
2877 |
|
2878 status = inSection(386); |
|
2879 pattern = /([\d-z]+)/; |
|
2880 string = 'a0-za'; |
|
2881 actualmatch = string.match(pattern); |
|
2882 expectedmatch = Array('0-z', '0-z'); |
|
2883 addThis(); |
|
2884 */ |
|
2885 |
|
2886 /* ECMA doesn't support [: |
|
2887 status = inSection(387); |
|
2888 pattern = /([a-[:digit:]]+)/; |
|
2889 string = 'za-9z'; |
|
2890 actualmatch = string.match(pattern); |
|
2891 expectedmatch = Array('a-9', 'a-9'); |
|
2892 addThis(); |
|
2893 |
|
2894 status = inSection(388); |
|
2895 pattern = /([[:digit:]-z]+)/; |
|
2896 string = '=0-z='; |
|
2897 actualmatch = string.match(pattern); |
|
2898 expectedmatch = Array('0-z', '0-z'); |
|
2899 addThis(); |
|
2900 |
|
2901 status = inSection(389); |
|
2902 pattern = /([[:digit:]-[:alpha:]]+)/; |
|
2903 string = '=0-z='; |
|
2904 actualmatch = string.match(pattern); |
|
2905 expectedmatch = Array('0-z', '0-z'); |
|
2906 addThis(); |
|
2907 */ |
|
2908 |
|
2909 status = inSection(390); |
|
2910 pattern = /(\d+\.\d+)/; |
|
2911 string = '3.1415926'; |
|
2912 actualmatch = string.match(pattern); |
|
2913 expectedmatch = Array('3.1415926', '3.1415926'); |
|
2914 addThis(); |
|
2915 |
|
2916 status = inSection(391); |
|
2917 pattern = /\.c(pp|xx|c)?$/i; |
|
2918 string = 'IO.c'; |
|
2919 actualmatch = string.match(pattern); |
|
2920 expectedmatch = Array('.c', undefined); |
|
2921 addThis(); |
|
2922 |
|
2923 status = inSection(392); |
|
2924 pattern = /(\.c(pp|xx|c)?$)/i; |
|
2925 string = 'IO.c'; |
|
2926 actualmatch = string.match(pattern); |
|
2927 expectedmatch = Array('.c', '.c', undefined); |
|
2928 addThis(); |
|
2929 |
|
2930 status = inSection(393); |
|
2931 pattern = /(^|a)b/; |
|
2932 string = 'ab'; |
|
2933 actualmatch = string.match(pattern); |
|
2934 expectedmatch = Array('ab', 'a'); |
|
2935 addThis(); |
|
2936 |
|
2937 status = inSection(394); |
|
2938 pattern = /^([ab]*?)(b)?(c)$/; |
|
2939 string = 'abac'; |
|
2940 actualmatch = string.match(pattern); |
|
2941 expectedmatch = Array('abac', 'aba', undefined, 'c'); |
|
2942 addThis(); |
|
2943 |
|
2944 status = inSection(395); |
|
2945 pattern = /^(?:.,){2}c/i; |
|
2946 string = 'a,b,c'; |
|
2947 actualmatch = string.match(pattern); |
|
2948 expectedmatch = Array('a,b,c'); |
|
2949 addThis(); |
|
2950 |
|
2951 status = inSection(396); |
|
2952 pattern = /^(.,){2}c/i; |
|
2953 string = 'a,b,c'; |
|
2954 actualmatch = string.match(pattern); |
|
2955 expectedmatch = Array('a,b,c', 'b,'); |
|
2956 addThis(); |
|
2957 |
|
2958 status = inSection(397); |
|
2959 pattern = /^(?:[^,]*,){2}c/; |
|
2960 string = 'a,b,c'; |
|
2961 actualmatch = string.match(pattern); |
|
2962 expectedmatch = Array('a,b,c'); |
|
2963 addThis(); |
|
2964 |
|
2965 status = inSection(398); |
|
2966 pattern = /^([^,]*,){2}c/; |
|
2967 string = 'a,b,c'; |
|
2968 actualmatch = string.match(pattern); |
|
2969 expectedmatch = Array('a,b,c', 'b,'); |
|
2970 addThis(); |
|
2971 |
|
2972 status = inSection(399); |
|
2973 pattern = /^([^,]*,){3}d/; |
|
2974 string = 'aaa,b,c,d'; |
|
2975 actualmatch = string.match(pattern); |
|
2976 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
2977 addThis(); |
|
2978 |
|
2979 status = inSection(400); |
|
2980 pattern = /^([^,]*,){3,}d/; |
|
2981 string = 'aaa,b,c,d'; |
|
2982 actualmatch = string.match(pattern); |
|
2983 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
2984 addThis(); |
|
2985 |
|
2986 status = inSection(401); |
|
2987 pattern = /^([^,]*,){0,3}d/; |
|
2988 string = 'aaa,b,c,d'; |
|
2989 actualmatch = string.match(pattern); |
|
2990 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
2991 addThis(); |
|
2992 |
|
2993 status = inSection(402); |
|
2994 pattern = /^([^,]{1,3},){3}d/i; |
|
2995 string = 'aaa,b,c,d'; |
|
2996 actualmatch = string.match(pattern); |
|
2997 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
2998 addThis(); |
|
2999 |
|
3000 status = inSection(403); |
|
3001 pattern = /^([^,]{1,3},){3,}d/; |
|
3002 string = 'aaa,b,c,d'; |
|
3003 actualmatch = string.match(pattern); |
|
3004 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3005 addThis(); |
|
3006 |
|
3007 status = inSection(404); |
|
3008 pattern = /^([^,]{1,3},){0,3}d/; |
|
3009 string = 'aaa,b,c,d'; |
|
3010 actualmatch = string.match(pattern); |
|
3011 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3012 addThis(); |
|
3013 |
|
3014 status = inSection(405); |
|
3015 pattern = /^([^,]{1,},){3}d/; |
|
3016 string = 'aaa,b,c,d'; |
|
3017 actualmatch = string.match(pattern); |
|
3018 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3019 addThis(); |
|
3020 |
|
3021 status = inSection(406); |
|
3022 pattern = /^([^,]{1,},){3,}d/; |
|
3023 string = 'aaa,b,c,d'; |
|
3024 actualmatch = string.match(pattern); |
|
3025 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3026 addThis(); |
|
3027 |
|
3028 status = inSection(407); |
|
3029 pattern = /^([^,]{1,},){0,3}d/; |
|
3030 string = 'aaa,b,c,d'; |
|
3031 actualmatch = string.match(pattern); |
|
3032 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3033 addThis(); |
|
3034 |
|
3035 status = inSection(408); |
|
3036 pattern = /^([^,]{0,3},){3}d/i; |
|
3037 string = 'aaa,b,c,d'; |
|
3038 actualmatch = string.match(pattern); |
|
3039 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3040 addThis(); |
|
3041 |
|
3042 status = inSection(409); |
|
3043 pattern = /^([^,]{0,3},){3,}d/; |
|
3044 string = 'aaa,b,c,d'; |
|
3045 actualmatch = string.match(pattern); |
|
3046 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3047 addThis(); |
|
3048 |
|
3049 status = inSection(410); |
|
3050 pattern = /^([^,]{0,3},){0,3}d/; |
|
3051 string = 'aaa,b,c,d'; |
|
3052 actualmatch = string.match(pattern); |
|
3053 expectedmatch = Array('aaa,b,c,d', 'c,'); |
|
3054 addThis(); |
|
3055 |
|
3056 /* ECMA doesn't support \A |
|
3057 status = inSection(411); |
|
3058 pattern = /(?!\A)x/m; |
|
3059 string = 'a\nxb\n'; |
|
3060 actualmatch = string.match(pattern); |
|
3061 expectedmatch = Array('\n'); |
|
3062 addThis(); |
|
3063 */ |
|
3064 |
|
3065 status = inSection(412); |
|
3066 pattern = /^(a(b)?)+$/; |
|
3067 string = 'aba'; |
|
3068 actualmatch = string.match(pattern); |
|
3069 expectedmatch = Array('aba', 'a', undefined); |
|
3070 addThis(); |
|
3071 |
|
3072 status = inSection(413); |
|
3073 pattern = /^(aa(bb)?)+$/; |
|
3074 string = 'aabbaa'; |
|
3075 actualmatch = string.match(pattern); |
|
3076 expectedmatch = Array('aabbaa', 'aa', undefined); |
|
3077 addThis(); |
|
3078 |
|
3079 status = inSection(414); |
|
3080 pattern = /^.{9}abc.*\n/m; |
|
3081 string = '123\nabcabcabcabc\n'; |
|
3082 actualmatch = string.match(pattern); |
|
3083 expectedmatch = Array('abcabcabcabc\n'); |
|
3084 addThis(); |
|
3085 |
|
3086 status = inSection(415); |
|
3087 pattern = /^(a)?a$/; |
|
3088 string = 'a'; |
|
3089 actualmatch = string.match(pattern); |
|
3090 expectedmatch = Array('a', undefined); |
|
3091 addThis(); |
|
3092 |
|
3093 status = inSection(416); |
|
3094 pattern = /^(a\1?)(a\1?)(a\2?)(a\3?)$/; |
|
3095 string = 'aaaaaa'; |
|
3096 actualmatch = string.match(pattern); |
|
3097 expectedmatch = Array('aaaaaa', 'a', 'aa', 'a', 'aa'); |
|
3098 addThis(); |
|
3099 |
|
3100 /* Can't refer to a capture before it's encountered & completed |
|
3101 status = inSection(417); |
|
3102 pattern = /^(a\1?){4}$/; |
|
3103 string = 'aaaaaa'; |
|
3104 actualmatch = string.match(pattern); |
|
3105 expectedmatch = Array('aaaaaa', 'aaa'); |
|
3106 addThis(); |
|
3107 */ |
|
3108 |
|
3109 status = inSection(418); |
|
3110 pattern = /^(0+)?(?:x(1))?/; |
|
3111 string = 'x1'; |
|
3112 actualmatch = string.match(pattern); |
|
3113 expectedmatch = Array('x1', undefined, '1'); |
|
3114 addThis(); |
|
3115 |
|
3116 status = inSection(419); |
|
3117 pattern = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/; |
|
3118 string = '012cxx0190'; |
|
3119 actualmatch = string.match(pattern); |
|
3120 expectedmatch = Array('012cxx0190', '012c', undefined, '0190'); |
|
3121 addThis(); |
|
3122 |
|
3123 status = inSection(420); |
|
3124 pattern = /^(b+?|a){1,2}c/; |
|
3125 string = 'bbbac'; |
|
3126 actualmatch = string.match(pattern); |
|
3127 expectedmatch = Array('bbbac', 'a'); |
|
3128 addThis(); |
|
3129 |
|
3130 status = inSection(421); |
|
3131 pattern = /^(b+?|a){1,2}c/; |
|
3132 string = 'bbbbac'; |
|
3133 actualmatch = string.match(pattern); |
|
3134 expectedmatch = Array('bbbbac', 'a'); |
|
3135 addThis(); |
|
3136 |
|
3137 status = inSection(422); |
|
3138 pattern = /((?:aaaa|bbbb)cccc)?/; |
|
3139 string = 'aaaacccc'; |
|
3140 actualmatch = string.match(pattern); |
|
3141 expectedmatch = Array('aaaacccc', 'aaaacccc'); |
|
3142 addThis(); |
|
3143 |
|
3144 status = inSection(423); |
|
3145 pattern = /((?:aaaa|bbbb)cccc)?/; |
|
3146 string = 'bbbbcccc'; |
|
3147 actualmatch = string.match(pattern); |
|
3148 expectedmatch = Array('bbbbcccc', 'bbbbcccc'); |
|
3149 addThis(); |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 //----------------------------------------------------------------------------- |
|
3155 test(); |
|
3156 //----------------------------------------------------------------------------- |
|
3157 |
|
3158 |
|
3159 |
|
3160 function addThis() |
|
3161 { |
|
3162 if(omitCurrentSection()) |
|
3163 return; |
|
3164 |
|
3165 statusmessages[i] = status; |
|
3166 patterns[i] = pattern; |
|
3167 strings[i] = string; |
|
3168 actualmatches[i] = actualmatch; |
|
3169 expectedmatches[i] = expectedmatch; |
|
3170 i++; |
|
3171 } |
|
3172 |
|
3173 |
|
3174 function omitCurrentSection() |
|
3175 { |
|
3176 try |
|
3177 { |
|
3178 // current section number is in global status variable |
|
3179 var n = status.match(/(\d+)/)[1]; |
|
3180 return ((n < cnLBOUND) || (n > cnUBOUND)); |
|
3181 } |
|
3182 catch(e) |
|
3183 { |
|
3184 return false; |
|
3185 } |
|
3186 } |
|
3187 |
|
3188 |
|
3189 function test() |
|
3190 { |
|
3191 enterFunc ('test'); |
|
3192 printBugNumber(BUGNUMBER); |
|
3193 printStatus (summary); |
|
3194 testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); |
|
3195 exitFunc ('test'); |
|
3196 } |