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