/[pcre]/code/trunk/testdata/testoutput11
ViewVC logotype

Contents of /code/trunk/testdata/testoutput11

Parent Directory Parent Directory | Revision Log Revision Log


Revision 510 - (hide annotations) (download)
Sat Mar 27 17:45:29 2010 UTC (4 years, 6 months ago) by ph10
File size: 12233 byte(s)
Add support for *MARK and names for *PRUNE, *SKIP, *THEN.

1 ph10 450 /-- These tests are for the Perl 5.10 features that PCRE supports. --/
2    
3 ph10 448 /\H\h\V\v/
4     X X\x0a
5     0: X X\x0a
6     X\x09X\x0b
7     0: X\x09X\x0b
8     ** Failers
9     No match
10     \xa0 X\x0a
11     No match
12    
13     /\H*\h+\V?\v{3,4}/
14     \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
15     0: \x09 \xa0X\x0a\x0b\x0c\x0d
16     \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
17     0: \x09 \xa0\x0a\x0b\x0c\x0d
18     \x09\x20\xa0\x0a\x0b\x0c
19     0: \x09 \xa0\x0a\x0b\x0c
20     ** Failers
21     No match
22     \x09\x20\xa0\x0a\x0b
23     No match
24    
25     /\H{3,4}/
26     XY ABCDE
27     0: ABCD
28     XY PQR ST
29     0: PQR
30    
31     /.\h{3,4}./
32     XY AB PQRS
33     0: B P
34    
35     /\h*X\h?\H+Y\H?Z/
36     >XNNNYZ
37     0: XNNNYZ
38     > X NYQZ
39     0: X NYQZ
40     ** Failers
41     No match
42     >XYZ
43     No match
44     > X NY Z
45     No match
46    
47     /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
48     >XY\x0aZ\x0aA\x0bNN\x0c
49     0: XY\x0aZ\x0aA\x0bNN\x0c
50     >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
51     0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
52    
53     /(foo)\Kbar/
54     foobar
55     0: bar
56     1: foo
57    
58     /(foo)(\Kbar|baz)/
59     foobar
60     0: bar
61     1: foo
62     2: bar
63     foobaz
64     0: foobaz
65     1: foo
66     2: baz
67    
68     /(foo\Kbar)baz/
69     foobarbaz
70     0: barbaz
71     1: foobar
72    
73     /abc\K|def\K/g+
74     Xabcdefghi
75     0:
76     0+ defghi
77     0:
78     0+ ghi
79    
80     /ab\Kc|de\Kf/g+
81     Xabcdefghi
82     0: c
83     0+ defghi
84     0: f
85     0+ ghi
86    
87     /(?=C)/g+
88     ABCDECBA
89     0:
90     0+ CDECBA
91     0:
92     0+ CBA
93    
94     /^abc\K/+
95     abcdef
96     0:
97     0+ def
98     ** Failers
99     No match
100     defabcxyz
101     No match
102    
103     /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
104     ababababbbabZXXXX
105     0: ababababbbabZ
106     1: ab
107     2: b
108    
109     /(?<A>tom|bon)-\g{A}/
110     tom-tom
111     0: tom-tom
112     1: tom
113     bon-bon
114     0: bon-bon
115     1: bon
116    
117     /(^(a|b\g{-1}))/
118     bacxxx
119     No match
120    
121     /(?|(abc)|(xyz))\1/
122     abcabc
123     0: abcabc
124     1: abc
125     xyzxyz
126     0: xyzxyz
127     1: xyz
128     ** Failers
129     No match
130     abcxyz
131     No match
132     xyzabc
133     No match
134    
135     /(?|(abc)|(xyz))(?1)/
136     abcabc
137     0: abcabc
138     1: abc
139     xyzabc
140     0: xyzabc
141     1: xyz
142     ** Failers
143     No match
144     xyzxyz
145     No match
146    
147     /^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
148     XYabcdY
149     0: XYabcdY
150     1: a
151     2: b
152     3: c
153     4: d
154     5: Y
155    
156     /^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
157     XYabcdY
158     0: XYabcdY
159     1: a
160     2: b
161     3: <unset>
162     4: <unset>
163     5: c
164     6: d
165     7: Y
166    
167     /^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
168     XYabcdY
169     0: XYabcdY
170     1: a
171     2: b
172     3: <unset>
173     4: <unset>
174     5: c
175     6: d
176     7: Y
177    
178     /(?'abc'\w+):\k<abc>{2}/
179     a:aaxyz
180     0: a:aa
181     1: a
182     ab:ababxyz
183     0: ab:abab
184     1: ab
185     ** Failers
186     No match
187     a:axyz
188     No match
189     ab:abxyz
190     No match
191    
192     /(?'abc'\w+):\g{abc}{2}/
193     a:aaxyz
194     0: a:aa
195     1: a
196     ab:ababxyz
197     0: ab:abab
198     1: ab
199     ** Failers
200     No match
201     a:axyz
202     No match
203     ab:abxyz
204     No match
205    
206     /^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
207     abd
208     0: abd
209     1: a
210     ce
211     0: ce
212    
213     /^(a.)\g-1Z/
214     aXaXZ
215     0: aXaXZ
216     1: aX
217    
218     /^(a.)\g{-1}Z/
219     aXaXZ
220     0: aXaXZ
221     1: aX
222    
223     /^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
224     abcd
225     0: ab
226    
227     /(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
228     (?(DEFINE)
229     (?<NAME_PAT>[a-z]+)
230     (?<ADDRESS_PAT>\d+)
231     )/x
232     metcalfe 33
233     0: metcalfe 33
234     1: metcalfe
235     2: 33
236    
237     /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
238     1.2.3.4
239     0: 1.2.3.4
240     1: <unset>
241     2: .4
242     131.111.10.206
243     0: 131.111.10.206
244     1: <unset>
245     2: .206
246     10.0.0.0
247     0: 10.0.0.0
248     1: <unset>
249     2: .0
250     ** Failers
251     No match
252     10.6
253     No match
254     455.3.4.5
255     No match
256    
257     /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
258     1.2.3.4
259     0: 1.2.3.4
260     1: .4
261     131.111.10.206
262     0: 131.111.10.206
263     1: .206
264     10.0.0.0
265     0: 10.0.0.0
266     1: .0
267     ** Failers
268     No match
269     10.6
270     No match
271     455.3.4.5
272     No match
273    
274     /^(\w++|\s++)*$/
275     now is the time for all good men to come to the aid of the party
276     0: now is the time for all good men to come to the aid of the party
277     1: party
278     *** Failers
279     No match
280     this is not a line with only words and spaces!
281     No match
282    
283     /(\d++)(\w)/
284     12345a
285     0: 12345a
286     1: 12345
287     2: a
288     *** Failers
289     No match
290     12345+
291     No match
292    
293     /a++b/
294     aaab
295     0: aaab
296    
297     /(a++b)/
298     aaab
299     0: aaab
300     1: aaab
301    
302     /(a++)b/
303     aaab
304     0: aaab
305     1: aaa
306    
307     /([^()]++|\([^()]*\))+/
308     ((abc(ade)ufh()()x
309     0: abc(ade)ufh()()x
310     1: x
311    
312     /\(([^()]++|\([^()]+\))+\)/
313     (abc)
314     0: (abc)
315     1: abc
316     (abc(def)xyz)
317     0: (abc(def)xyz)
318     1: xyz
319     *** Failers
320     No match
321     ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
322     No match
323    
324     /^([^()]|\((?1)*\))*$/
325     abc
326     0: abc
327     1: c
328     a(b)c
329     0: a(b)c
330     1: c
331     a(b(c))d
332     0: a(b(c))d
333     1: d
334     *** Failers)
335     No match
336     a(b(c)d
337     No match
338    
339     /^>abc>([^()]|\((?1)*\))*<xyz<$/
340     >abc>123<xyz<
341     0: >abc>123<xyz<
342     1: 3
343     >abc>1(2)3<xyz<
344     0: >abc>1(2)3<xyz<
345     1: 3
346     >abc>(1(2)3)<xyz<
347     0: >abc>(1(2)3)<xyz<
348     1: (1(2)3)
349    
350     /^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
351     1221
352     0: 1221
353     1: 1221
354     2: 1
355     Satanoscillatemymetallicsonatas
356     0: Satanoscillatemymetallicsonatas
357     1: <unset>
358     2: <unset>
359     3: Satanoscillatemymetallicsonatas
360     4: S
361     AmanaplanacanalPanama
362     0: AmanaplanacanalPanama
363     1: <unset>
364     2: <unset>
365     3: AmanaplanacanalPanama
366     4: A
367     AblewasIereIsawElba
368     0: AblewasIereIsawElba
369     1: <unset>
370     2: <unset>
371     3: AblewasIereIsawElba
372     4: A
373     *** Failers
374     No match
375     Thequickbrownfox
376     No match
377    
378     /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
379     12
380     0: 12
381     1: 12
382     (((2+2)*-3)-7)
383     0: (((2+2)*-3)-7)
384     1: (((2+2)*-3)-7)
385     2: -
386     -12
387     0: -12
388     1: -12
389     *** Failers
390     No match
391     ((2+2)*-3)-7)
392     No match
393    
394     /^(x(y|(?1){2})z)/
395     xyz
396     0: xyz
397     1: xyz
398     2: y
399     xxyzxyzz
400     0: xxyzxyzz
401     1: xxyzxyzz
402     2: xyzxyz
403     *** Failers
404     No match
405     xxyzz
406     No match
407     xxyzxyzxyzz
408     No match
409    
410     /((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
411     <>
412     0: <>
413     1: <>
414     2: <>
415     <abcd>
416     0: <abcd>
417     1: <abcd>
418     2: <abcd>
419     <abc <123> hij>
420     0: <abc <123> hij>
421     1: <abc <123> hij>
422     2: <abc <123> hij>
423     <abc <def> hij>
424     0: <def>
425     1: <def>
426     2: <def>
427     <abc<>def>
428     0: <abc<>def>
429     1: <abc<>def>
430     2: <abc<>def>
431     <abc<>
432     0: <>
433     1: <>
434     2: <>
435     *** Failers
436     No match
437     <abc
438     No match
439    
440     /^a+(*FAIL)/
441     aaaaaa
442     No match
443    
444     /a+b?c+(*FAIL)/
445     aaabccc
446     No match
447    
448     /a+b?(*PRUNE)c+(*FAIL)/
449     aaabccc
450     No match
451    
452     /a+b?(*COMMIT)c+(*FAIL)/
453     aaabccc
454     No match
455    
456     /a+b?(*SKIP)c+(*FAIL)/
457     aaabcccaaabccc
458     No match
459    
460     /^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
461     aaaxxxxxx
462     0: aaaxxxxxx
463     aaa++++++
464     0: aaa
465     bbbxxxxx
466     0: bbbxxxxx
467     bbb+++++
468     0: bbb
469     cccxxxx
470     0: cccxxxx
471     ccc++++
472     0: ccc
473     dddddddd
474     0: ddd
475    
476     /^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
477     aaaxxxxxx
478     0: aaaxxxxxx
479     1: aaaxxxxxx
480     aaa++++++
481     0: aaa
482     1: aaa
483     bbbxxxxx
484     0: bbbxxxxx
485     1: bbbxxxxx
486     bbb+++++
487     0: bbb
488     1: bbb
489     cccxxxx
490     0: cccxxxx
491     1: cccxxxx
492     ccc++++
493     0: ccc
494     1: ccc
495     dddddddd
496     0: ddd
497     1: ddd
498    
499     /a+b?(*THEN)c+(*FAIL)/
500     aaabccc
501     No match
502    
503     /(A (A|B(*ACCEPT)|C) D)(E)/x
504     ABX
505     0: AB
506     1: AB
507     2: B
508     AADE
509     0: AADE
510     1: AAD
511     2: A
512     3: E
513     ACDE
514     0: ACDE
515     1: ACD
516     2: C
517     3: E
518     ** Failers
519     No match
520     AD
521     No match
522    
523 ph10 453 /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i
524     1221
525     0: 1221
526     1: 1221
527     2: 1
528     Satan, oscillate my metallic sonatas!
529     0: Satan, oscillate my metallic sonatas!
530     1: <unset>
531     2: <unset>
532     3: Satan, oscillate my metallic sonatas
533     4: S
534     A man, a plan, a canal: Panama!
535     0: A man, a plan, a canal: Panama!
536     1: <unset>
537     2: <unset>
538     3: A man, a plan, a canal: Panama
539     4: A
540     Able was I ere I saw Elba.
541     0: Able was I ere I saw Elba.
542     1: <unset>
543     2: <unset>
544     3: Able was I ere I saw Elba
545     4: A
546     *** Failers
547     No match
548     The quick brown fox
549     No match
550    
551     /^((.)(?1)\2|.)$/
552     a
553     0: a
554     1: a
555     aba
556     0: aba
557     1: aba
558     2: a
559     aabaa
560     0: aabaa
561     1: aabaa
562     2: a
563     abcdcba
564     0: abcdcba
565     1: abcdcba
566     2: a
567     pqaabaaqp
568     0: pqaabaaqp
569     1: pqaabaaqp
570     2: p
571     ablewasiereisawelba
572     0: ablewasiereisawelba
573     1: ablewasiereisawelba
574     2: a
575     rhubarb
576     No match
577     the quick brown fox
578     No match
579    
580 ph10 454 /(a)(?<=b(?1))/
581     baz
582     0: a
583     1: a
584     ** Failers
585     No match
586     caz
587     No match
588    
589     /(?<=b(?1))(a)/
590     zbaaz
591     0: a
592     1: a
593     ** Failers
594     No match
595     aaa
596     No match
597    
598     /(?<X>a)(?<=b(?&X))/
599     baz
600     0: a
601     1: a
602    
603 ph10 457 /^(?|(abc)|(def))\1/
604     abcabc
605     0: abcabc
606     1: abc
607     defdef
608     0: defdef
609     1: def
610     ** Failers
611     No match
612     abcdef
613     No match
614     defabc
615     No match
616    
617     /^(?|(abc)|(def))(?1)/
618     abcabc
619     0: abcabc
620     1: abc
621     defabc
622     0: defabc
623     1: def
624     ** Failers
625     No match
626     defdef
627     No match
628     abcdef
629     No match
630    
631 ph10 459 /(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ
632     a\"aaaaa
633     0: a"aaaaa
634     1: "
635     2: <unset>
636     3: "
637     b\"aaaaa
638     0: b"aaaaa
639     1: <unset>
640     2: <unset>
641     3: <unset>
642     4: "
643     5: <unset>
644     6: "
645     ** Failers
646     No match
647     b\"11111
648     No match
649    
650 ph10 464 /(?:(?1)|B)(A(*F)|C)/
651     ABCD
652     0: BC
653     1: C
654     CCD
655     0: CC
656     1: C
657     ** Failers
658     No match
659     CAD
660     No match
661    
662     /^(?:(?1)|B)(A(*F)|C)/
663     CCD
664     0: CC
665     1: C
666     BCD
667     0: BC
668     1: C
669     ** Failers
670     No match
671     ABCD
672     No match
673     CAD
674     No match
675     BAD
676     No match
677    
678     /(?:(?1)|B)(A(*ACCEPT)XX|C)D/
679     AAD
680     0: AA
681     1: A
682     ACD
683     0: ACD
684     1: C
685     BAD
686     0: BA
687     1: A
688     BCD
689     0: BCD
690     1: C
691     BAX
692     0: BA
693     1: A
694     ** Failers
695     No match
696     ACX
697     No match
698     ABC
699     No match
700    
701     /(?(DEFINE)(A))B(?1)C/
702     BAC
703     0: BAC
704    
705     /(?(DEFINE)((A)\2))B(?1)C/
706     BAAC
707     0: BAAC
708    
709     /(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x
710     (ab(cd)ef)
711     0: (ab(cd)ef)
712     1: (ab(cd)ef)
713     2: ef
714    
715 ph10 473 /^(?!a(*SKIP)b)/
716     ac
717     0:
718    
719     /^(?=a(*SKIP)b|ac)/
720     ** Failers
721     No match
722     ac
723     No match
724    
725     /^(?=a(*THEN)b|ac)/
726     ac
727     0:
728    
729     /^(?=a(*PRUNE)b)/
730     ab
731     0:
732     ** Failers
733     No match
734     ac
735     No match
736    
737     /^(?=a(*ACCEPT)b)/
738     ac
739     0:
740    
741     /^(?(?!a(*SKIP)b))/
742     ac
743     0:
744    
745 ph10 500 /(?>a\Kb)/
746     ab
747     0: b
748    
749     /((?>a\Kb))/
750     ab
751     0: b
752     1: ab
753    
754     /(a\Kb)/
755     ab
756     0: b
757     1: ab
758    
759     /^a\Kcz|ac/
760     ac
761     0: ac
762    
763     /(?>a\Kbz|ab)/
764     ab
765     0: ab
766    
767     /^(?&t)(?(DEFINE)(?<t>a\Kb))$/
768     ab
769     0: b
770    
771     /^([^()]|\((?1)*\))*$/
772     a(b)c
773     0: a(b)c
774     1: c
775     a(b(c)d)e
776     0: a(b(c)d)e
777     1: e
778    
779 ph10 503 /(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
780     0
781     0: 0
782     1: 0
783     00
784     0: 00
785     1: 00
786     2: 0
787     0000
788     0: 0000
789     1: 0000
790     2: 0
791    
792     /(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
793     0
794     0: 0
795     1: 0
796     2: 0
797     00
798     0: 0
799     1: 0
800     2: 0
801     0000
802     0: 0
803     1: 0
804     2: 0
805    
806 ph10 510 /--- This one does fail, as expected, in Perl. It needs the complex item at the
807     end of the pattern. A single letter instead of (B|D) makes it not fail,
808     which I think is a Perl bug. --- /
809    
810     /A(*COMMIT)(B|D)/
811     ACABX
812     No match
813    
814     /--- Check the use of names for failure ---/
815    
816     /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
817     ** Failers
818     No match
819     AC
820     No match, mark = A
821     CB
822     No match, mark = B
823    
824     /(*MARK:A)(*SKIP:B)(C|X)/K
825     C
826     0: C
827     1: C
828     MK: A
829     D
830     No match, mark = A
831    
832     /^(A(*THEN:A)B|C(*THEN:B)D)/K
833     ** Failers
834     No match
835     CB
836     No match, mark = B
837    
838     /^(?:A(*THEN:A)B|C(*THEN:B)D)/K
839     CB
840     No match, mark = B
841    
842     /^(?>A(*THEN:A)B|C(*THEN:B)D)/K
843     CB
844     No match, mark = B
845    
846     /--- This should succeed, as the skip causes bump to offset 1 (the mark). Note
847     that we have to have something complicated such as (B|Z) at the end because,
848     for Perl, a simple character somehow causes an unwanted optimization to mess
849     with the handling of backtracking verbs. ---/
850    
851     /A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK
852     AAAC
853     0: AC
854    
855     /--- Test skipping over a non-matching mark. ---/
856    
857     /A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK
858     AAAC
859     0: AC
860    
861     /--- Check shorthand for MARK ---/
862    
863     /A(*:A)A+(*SKIP:A)(B|Z) | AC/xK
864     AAAC
865     0: AC
866    
867     /--- This should succeed, as a non-existent skip name disables the skip ---/
868    
869     /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
870     AAAC
871     0: AC
872    
873     /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK
874     AAAC
875     0: AC
876     MK: B
877    
878     /--- We use something more complicated than individual letters here, because
879     that causes different behaviour in Perl. Perhaps it disables some optimization;
880     anyway, the result now matches PCRE in that no tag is passed back for the
881     failures. ---/
882    
883     /(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/xK
884     AABC
885     0: AB
886     1: A
887     2: B
888     MK: A
889     XXYZ
890     0: XXY
891     1: <unset>
892     2: <unset>
893     3: X
894     4: X
895     5: Y
896     MK: B
897     ** Failers
898     No match
899     XAQQ
900     No match
901     XAQQXZZ
902     No match
903     AXQQQ
904     No match
905     AXXQQQ
906     No match
907    
908     /--- COMMIT at the start of a pattern should act like an anchor. Again,
909     however, we need the complication for Perl. ---/
910    
911     /(*COMMIT)(A|P)(B|P)(C|P)/
912     ABCDEFG
913     0: ABC
914     1: A
915     2: B
916     3: C
917     ** Failers
918     No match
919     DEFGABC
920     No match
921    
922     /--- COMMIT inside an atomic group can't stop backtracking over the group. ---/
923    
924     /(\w+)(?>b(*COMMIT))\w{2}/
925     abbb
926     0: abbb
927     1: a
928    
929     /(\w+)b(*COMMIT)\w{2}/
930     abbb
931     No match
932    
933 ph10 450 /-- End of testinput11 --/

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12