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