| 803 |
1: 0 |
1: 0 |
| 804 |
2: 0 |
2: 0 |
| 805 |
|
|
| 806 |
|
/--- 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 |
/-- End of testinput11 --/ |
/-- End of testinput11 --/ |