| 3 |
It also checks the non-Perl syntax the PCRE supports (Python, .NET, |
It also checks the non-Perl syntax the PCRE supports (Python, .NET, |
| 4 |
Oniguruma). Finally, there are some tests where PCRE and Perl differ, |
Oniguruma). Finally, there are some tests where PCRE and Perl differ, |
| 5 |
either because PCRE can't be compatible, or there is a possible Perl |
either because PCRE can't be compatible, or there is a possible Perl |
| 6 |
bug. |
bug. --/ |
|
|
|
|
NOTE: This is a non-UTF-8 set of tests. When UTF-8 is needed, use test |
|
|
5, and if Unicode Property Support is needed, use test 13. --/ |
|
| 7 |
|
|
| 8 |
/-- Originally, the Perl >= 5.10 things were in here too, but now I have |
/-- Originally, the Perl >= 5.10 things were in here too, but now I have |
| 9 |
separated many (most?) of them out into test 11. However, there may still |
separated many (most?) of them out into test 11. However, there may still |
| 10989 |
AC |
AC |
| 10990 |
No match |
No match |
| 10991 |
|
|
| 10992 |
|
/--- A whole lot of tests of verbs with arguments are here rather than in test |
| 10993 |
|
11 because Perl doesn't seem to follow its specification entirely |
| 10994 |
|
correctly. ---/ |
| 10995 |
|
|
| 10996 |
|
/--- Perl 5.11 sets $REGERROR on the AC failure case here; PCRE does not. It is |
| 10997 |
|
not clear how Perl defines "involved in the failure of the match". ---/ |
| 10998 |
|
|
| 10999 |
|
/^(A(*THEN:A)B|C(*THEN:B)D)/K |
| 11000 |
|
AB |
| 11001 |
|
0: AB |
| 11002 |
|
1: AB |
| 11003 |
|
CD |
| 11004 |
|
0: CD |
| 11005 |
|
1: CD |
| 11006 |
|
** Failers |
| 11007 |
|
No match |
| 11008 |
|
AC |
| 11009 |
|
No match |
| 11010 |
|
CB |
| 11011 |
|
No match, mark = B |
| 11012 |
|
|
| 11013 |
|
/--- Check the use of names for success and failure. PCRE doesn't show these |
| 11014 |
|
names for success, though Perl does, contrary to its spec. ---/ |
| 11015 |
|
|
| 11016 |
|
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K |
| 11017 |
|
AB |
| 11018 |
|
0: AB |
| 11019 |
|
1: AB |
| 11020 |
|
CD |
| 11021 |
|
0: CD |
| 11022 |
|
1: CD |
| 11023 |
|
** Failers |
| 11024 |
|
No match |
| 11025 |
|
AC |
| 11026 |
|
No match, mark = A |
| 11027 |
|
CB |
| 11028 |
|
No match, mark = B |
| 11029 |
|
|
| 11030 |
|
/--- An empty name does not pass back an empty string. It is the same as if no |
| 11031 |
|
name were given. ---/ |
| 11032 |
|
|
| 11033 |
|
/^(A(*PRUNE:)B|C(*PRUNE:B)D)/K |
| 11034 |
|
AB |
| 11035 |
|
0: AB |
| 11036 |
|
1: AB |
| 11037 |
|
CD |
| 11038 |
|
0: CD |
| 11039 |
|
1: CD |
| 11040 |
|
|
| 11041 |
|
/--- PRUNE goes to next bumpalong; COMMIT does not. ---/ |
| 11042 |
|
|
| 11043 |
|
/A(*PRUNE:A)B/K |
| 11044 |
|
ACAB |
| 11045 |
|
0: AB |
| 11046 |
|
|
| 11047 |
|
/(*MARK:A)(*PRUNE:B)(C|X)/KS |
| 11048 |
|
C |
| 11049 |
|
0: C |
| 11050 |
|
1: C |
| 11051 |
|
MK: A |
| 11052 |
|
D |
| 11053 |
|
No match |
| 11054 |
|
|
| 11055 |
|
/(*MARK:A)(*PRUNE:B)(C|X)/KSS |
| 11056 |
|
C |
| 11057 |
|
0: C |
| 11058 |
|
1: C |
| 11059 |
|
MK: A |
| 11060 |
|
D |
| 11061 |
|
No match, mark = B |
| 11062 |
|
|
| 11063 |
|
/(*MARK:A)(*THEN:B)(C|X)/KS |
| 11064 |
|
C |
| 11065 |
|
0: C |
| 11066 |
|
1: C |
| 11067 |
|
MK: A |
| 11068 |
|
D |
| 11069 |
|
No match |
| 11070 |
|
|
| 11071 |
|
/(*MARK:A)(*THEN:B)(C|X)/KSY |
| 11072 |
|
C |
| 11073 |
|
0: C |
| 11074 |
|
1: C |
| 11075 |
|
MK: A |
| 11076 |
|
D |
| 11077 |
|
No match, mark = B |
| 11078 |
|
|
| 11079 |
|
/(*MARK:A)(*THEN:B)(C|X)/KSS |
| 11080 |
|
C |
| 11081 |
|
0: C |
| 11082 |
|
1: C |
| 11083 |
|
MK: A |
| 11084 |
|
D |
| 11085 |
|
No match, mark = B |
| 11086 |
|
|
| 11087 |
|
/--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/ |
| 11088 |
|
|
| 11089 |
|
/A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK |
| 11090 |
|
AAAC |
| 11091 |
|
No match |
| 11092 |
|
|
| 11093 |
|
/--- Same --/ |
| 11094 |
|
|
| 11095 |
|
/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK |
| 11096 |
|
AAAC |
| 11097 |
|
No match |
| 11098 |
|
|
| 11099 |
/--- This should fail; the SKIP advances by one, but when we get to AC, the |
/--- This should fail; the SKIP advances by one, but when we get to AC, the |
| 11100 |
PRUNE kills it. Perl behaves differently. ---/ |
PRUNE kills it. ---/ |
| 11101 |
|
|
| 11102 |
/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK |
/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK |
| 11103 |
AAAC |
AAAC |
| 11104 |
No match, mark = A |
No match |
| 11105 |
|
|
| 11106 |
/--- Mark names can be duplicated. Perl doesn't give a mark for this one, |
/A(*:A)A+(*SKIP)(B|Z) | AC/xK |
| 11107 |
though PCRE does. ---/ |
AAAC |
| 11108 |
|
No match |
| 11109 |
|
|
| 11110 |
|
/--- This should fail, as a null name is the same as no name ---/ |
| 11111 |
|
|
| 11112 |
|
/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK |
| 11113 |
|
AAAC |
| 11114 |
|
No match |
| 11115 |
|
|
| 11116 |
|
/--- This fails in PCRE, and I think that is in accordance with Perl's |
| 11117 |
|
documentation, though in Perl it succeeds. ---/ |
| 11118 |
|
|
| 11119 |
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK |
| 11120 |
|
AAAC |
| 11121 |
|
No match |
| 11122 |
|
|
| 11123 |
|
/--- Mark names can be duplicated ---/ |
| 11124 |
|
|
| 11125 |
|
/A(*:A)B|X(*:A)Y/K |
| 11126 |
|
AABC |
| 11127 |
|
0: AB |
| 11128 |
|
MK: A |
| 11129 |
|
XXYZ |
| 11130 |
|
0: XY |
| 11131 |
|
MK: A |
| 11132 |
|
|
| 11133 |
/^A(*:A)B|^X(*:A)Y/K |
/^A(*:A)B|^X(*:A)Y/K |
| 11134 |
** Failers |
** Failers |
| 11135 |
No match |
No match |
| 11136 |
XAQQ |
XAQQ |
| 11137 |
No match, mark = A |
No match, mark = A |
| 11138 |
|
|
| 11139 |
|
/--- A check on what happens after hitting a mark and them bumping along to |
| 11140 |
|
something that does not even start. Perl reports tags after the failures here, |
| 11141 |
|
though it does not when the individual letters are made into something |
| 11142 |
|
more complicated. ---/ |
| 11143 |
|
|
| 11144 |
|
/A(*:A)B|XX(*:B)Y/K |
| 11145 |
|
AABC |
| 11146 |
|
0: AB |
| 11147 |
|
MK: A |
| 11148 |
|
XXYZ |
| 11149 |
|
0: XXY |
| 11150 |
|
MK: B |
| 11151 |
|
** Failers |
| 11152 |
|
No match |
| 11153 |
|
XAQQ |
| 11154 |
|
No match |
| 11155 |
|
XAQQXZZ |
| 11156 |
|
No match |
| 11157 |
|
AXQQQ |
| 11158 |
|
No match |
| 11159 |
|
AXXQQQ |
| 11160 |
|
No match |
| 11161 |
|
|
| 11162 |
/--- COMMIT at the start of a pattern should be the same as an anchor. Perl |
/--- COMMIT at the start of a pattern should be the same as an anchor. Perl |
| 11163 |
optimizations defeat this. So does the PCRE optimization unless we disable it |
optimizations defeat this. So does the PCRE optimization unless we disable it |
| 11164 |
with \Y. ---/ |
with \Y. ---/ |
| 11171 |
DEFGABC\Y |
DEFGABC\Y |
| 11172 |
No match |
No match |
| 11173 |
|
|
| 11174 |
|
/--- Repeat some tests with added studying. ---/ |
| 11175 |
|
|
| 11176 |
|
/A(*COMMIT)B/+KS |
| 11177 |
|
ACABX |
| 11178 |
|
No match |
| 11179 |
|
|
| 11180 |
|
/A(*THEN)B|A(*THEN)C/KS |
| 11181 |
|
AC |
| 11182 |
|
0: AC |
| 11183 |
|
|
| 11184 |
|
/A(*PRUNE)B|A(*PRUNE)C/KS |
| 11185 |
|
AC |
| 11186 |
|
No match |
| 11187 |
|
|
| 11188 |
|
/^(A(*THEN:A)B|C(*THEN:B)D)/KS |
| 11189 |
|
AB |
| 11190 |
|
0: AB |
| 11191 |
|
1: AB |
| 11192 |
|
CD |
| 11193 |
|
0: CD |
| 11194 |
|
1: CD |
| 11195 |
|
** Failers |
| 11196 |
|
No match |
| 11197 |
|
AC |
| 11198 |
|
No match |
| 11199 |
|
CB |
| 11200 |
|
No match, mark = B |
| 11201 |
|
|
| 11202 |
|
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/KS |
| 11203 |
|
AB |
| 11204 |
|
0: AB |
| 11205 |
|
1: AB |
| 11206 |
|
CD |
| 11207 |
|
0: CD |
| 11208 |
|
1: CD |
| 11209 |
|
** Failers |
| 11210 |
|
No match |
| 11211 |
|
AC |
| 11212 |
|
No match, mark = A |
| 11213 |
|
CB |
| 11214 |
|
No match, mark = B |
| 11215 |
|
|
| 11216 |
|
/^(A(*PRUNE:)B|C(*PRUNE:B)D)/KS |
| 11217 |
|
AB |
| 11218 |
|
0: AB |
| 11219 |
|
1: AB |
| 11220 |
|
CD |
| 11221 |
|
0: CD |
| 11222 |
|
1: CD |
| 11223 |
|
|
| 11224 |
|
/A(*PRUNE:A)B/KS |
| 11225 |
|
ACAB |
| 11226 |
|
0: AB |
| 11227 |
|
|
| 11228 |
|
/(*MARK:A)(*PRUNE:B)(C|X)/KS |
| 11229 |
|
C |
| 11230 |
|
0: C |
| 11231 |
|
1: C |
| 11232 |
|
MK: A |
| 11233 |
|
D |
| 11234 |
|
No match |
| 11235 |
|
|
| 11236 |
|
/(*MARK:A)(*THEN:B)(C|X)/KS |
| 11237 |
|
C |
| 11238 |
|
0: C |
| 11239 |
|
1: C |
| 11240 |
|
MK: A |
| 11241 |
|
D |
| 11242 |
|
No match |
| 11243 |
|
|
| 11244 |
|
/A(*MARK:A)A+(*SKIP)(B|Z) | AC/xKS |
| 11245 |
|
AAAC |
| 11246 |
|
No match |
| 11247 |
|
|
| 11248 |
|
/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xKS |
| 11249 |
|
AAAC |
| 11250 |
|
No match |
| 11251 |
|
|
| 11252 |
|
/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xKS |
| 11253 |
|
AAAC |
| 11254 |
|
No match |
| 11255 |
|
|
| 11256 |
|
/A(*:A)A+(*SKIP)(B|Z) | AC/xKS |
| 11257 |
|
AAAC |
| 11258 |
|
No match |
| 11259 |
|
|
| 11260 |
|
/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xKS |
| 11261 |
|
AAAC |
| 11262 |
|
No match |
| 11263 |
|
|
| 11264 |
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xKS |
| 11265 |
|
AAAC |
| 11266 |
|
No match |
| 11267 |
|
|
| 11268 |
|
/A(*:A)B|XX(*:B)Y/KS |
| 11269 |
|
AABC |
| 11270 |
|
0: AB |
| 11271 |
|
MK: A |
| 11272 |
|
XXYZ |
| 11273 |
|
0: XXY |
| 11274 |
|
MK: B |
| 11275 |
|
** Failers |
| 11276 |
|
No match |
| 11277 |
|
XAQQ |
| 11278 |
|
No match |
| 11279 |
|
XAQQXZZ |
| 11280 |
|
No match |
| 11281 |
|
AXQQQ |
| 11282 |
|
No match |
| 11283 |
|
AXXQQQ |
| 11284 |
|
No match |
| 11285 |
|
|
| 11286 |
|
/(*COMMIT)ABC/ |
| 11287 |
|
ABCDEFG |
| 11288 |
|
0: ABC |
| 11289 |
|
** Failers |
| 11290 |
|
No match |
| 11291 |
|
DEFGABC\Y |
| 11292 |
|
No match |
| 11293 |
|
|
| 11294 |
/^(ab (c+(*THEN)cd) | xyz)/x |
/^(ab (c+(*THEN)cd) | xyz)/x |
| 11295 |
abcccd |
abcccd |
| 11296 |
No match |
No match |
| 11875 |
1: C |
1: C |
| 11876 |
MK: A |
MK: A |
| 11877 |
D |
D |
| 11878 |
No match, mark = A |
No match |
| 11879 |
|
|
| 11880 |
/(*:A)A+(*SKIP:A)(B|Z)/KS |
/(*:A)A+(*SKIP:A)(B|Z)/KS |
| 11881 |
AAAC |
AAAC |
| 11882 |
No match, mark = A |
No match |
| 11883 |
|
|
| 11884 |
/-- --/ |
/-- --/ |
| 11885 |
|
|
| 12257 |
Latest Mark: B |
Latest Mark: B |
| 12258 |
+18 ^ ^ z |
+18 ^ ^ z |
| 12259 |
+20 ^ a |
+20 ^ a |
| 12260 |
|
Latest Mark: <unset> |
| 12261 |
+21 ^^ e |
+21 ^^ e |
| 12262 |
+22 ^ ^ q |
+22 ^ ^ q |
| 12263 |
+23 ^ ^ ) |
+23 ^ ^ ) |
| 12518 |
ax1z |
ax1z |
| 12519 |
0: ax1z |
0: ax1z |
| 12520 |
|
|
| 12521 |
|
/^a\X41z/<JS> |
| 12522 |
|
aX41z |
| 12523 |
|
0: aX41z |
| 12524 |
|
*** Failers |
| 12525 |
|
No match |
| 12526 |
|
aAz |
| 12527 |
|
No match |
| 12528 |
|
|
| 12529 |
/^a\u0041z/<JS> |
/^a\u0041z/<JS> |
| 12530 |
aAz |
aAz |
| 12531 |
0: aAz |
0: aAz |
| 12591 |
End |
End |
| 12592 |
------------------------------------------------------------------ |
------------------------------------------------------------------ |
| 12593 |
|
|
| 12594 |
/a[\NB]c/ |
/(?<=ab\Cde)X/8 |
| 12595 |
Failed: \N is not supported in a class at offset 3 |
Failed: \C not allowed in lookbehind assertion at offset 10 |
|
|
|
|
/a[B-\Nc]/ |
|
|
Failed: \N is not supported in a class at offset 5 |
|
|
|
|
|
/(a)(?2){0,1999}?(b)/ |
|
|
|
|
|
/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/ |
|
|
|
|
|
/--- This test, with something more complicated than individual letters, causes |
|
|
different behaviour in Perl. Perhaps it disables some optimization; no tag is |
|
|
passed back for the failures, whereas in PCRE there is a tag. ---/ |
|
|
|
|
|
/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/xK |
|
|
AABC |
|
|
0: AB |
|
|
1: A |
|
|
2: B |
|
|
MK: A |
|
|
XXYZ |
|
|
0: XXY |
|
|
1: <unset> |
|
|
2: <unset> |
|
|
3: X |
|
|
4: X |
|
|
5: Y |
|
|
MK: B |
|
|
** Failers |
|
|
No match |
|
|
XAQQ |
|
|
No match, mark = A |
|
|
XAQQXZZ |
|
|
No match, mark = A |
|
|
AXQQQ |
|
|
No match, mark = A |
|
|
AXXQQQ |
|
|
No match, mark = B |
|
|
|
|
|
/-- Perl doesn't give marks for these, though it does if the alternatives are |
|
|
replaced by single letters. --/ |
|
|
|
|
|
/(b|q)(*:m)f|a(*:n)w/K |
|
|
aw |
|
|
0: aw |
|
|
MK: n |
|
|
** Failers |
|
|
No match, mark = n |
|
|
abc |
|
|
No match, mark = m |
|
|
|
|
|
/(q|b)(*:m)f|a(*:n)w/K |
|
|
aw |
|
|
0: aw |
|
|
MK: n |
|
|
** Failers |
|
|
No match, mark = n |
|
|
abc |
|
|
No match, mark = m |
|
|
|
|
|
/-- After a partial match, the behaviour is as for a failure. --/ |
|
|
|
|
|
/^a(*:X)bcde/K |
|
|
abc\P |
|
|
Partial match, mark=X: abc |
|
| 12596 |
|
|
| 12597 |
/-- End of testinput2 --/ |
/-- End of testinput2 --/ |