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