1.1 --- a/tools/pcre/testdata/testinput1 Sun Mar 17 11:29:55 2013 -0400
1.2 +++ b/tools/pcre/testdata/testinput1 Sun Mar 17 11:32:03 2013 -0400
1.3 @@ -1,3 +1,7 @@
1.4 +/-- This set of tests is for features that are compatible with all versions of
1.5 + Perl >= 5.10, in non-UTF-8 mode. It should run clean for both the 8-bit and
1.6 + 16-bit PCRE libraries. --/
1.7 +
1.8 /the quick brown fox/
1.9 the quick brown fox
1.10 The quick brown FOX
1.11 @@ -2329,15 +2333,14 @@
1.12 baz
1.13 foobarbaz
1.14
1.15 -/The case of aaaaaa is missed out below because I think Perl 5.005_02 gets/
1.16 -/it wrong; it sets $1 to aaa rather than aa. Compare the following test,/
1.17 -/where it does set $1 to aa when matching aaaaaa./
1.18 +/The cases of aaaa and aaaaaa are missed out below because Perl does things/
1.19 +/differently. We know that odd, and maybe incorrect, things happen with/
1.20 +/recursive references in Perl, as far as 5.11.3 - see some stuff in test #2./
1.21
1.22 /^(a\1?){4}$/
1.23 a
1.24 aa
1.25 aaa
1.26 - aaaa
1.27 aaaaa
1.28 aaaaaaa
1.29 aaaaaaaa
1.30 @@ -4064,4 +4067,1240 @@
1.31 /^%((?(?=[a])[^%])|b)*%$/
1.32 %ab%
1.33
1.34 -/ End of testinput1 /
1.35 +/(?i)a(?-i)b|c/
1.36 + XabX
1.37 + XAbX
1.38 + CcC
1.39 + ** Failers
1.40 + XABX
1.41 +
1.42 +/[\x00-\xff\s]+/
1.43 + \x0a\x0b\x0c\x0d
1.44 +
1.45 +/^\c/
1.46 + ?
1.47 +
1.48 +/(abc)\1/i
1.49 + abc
1.50 +
1.51 +/(abc)\1/
1.52 + abc
1.53 +
1.54 +/[^a]*/i
1.55 + 12abc
1.56 + 12ABC
1.57 +
1.58 +/[^a]*+/i
1.59 + 12abc
1.60 + 12ABC
1.61 +
1.62 +/[^a]*?X/i
1.63 + ** Failers
1.64 + 12abc
1.65 + 12ABC
1.66 +
1.67 +/[^a]+?X/i
1.68 + ** Failers
1.69 + 12abc
1.70 + 12ABC
1.71 +
1.72 +/[^a]?X/i
1.73 + 12aXbcX
1.74 + 12AXBCX
1.75 + BCX
1.76 +
1.77 +/[^a]??X/i
1.78 + 12aXbcX
1.79 + 12AXBCX
1.80 + BCX
1.81 +
1.82 +/[^a]?+X/i
1.83 + 12aXbcX
1.84 + 12AXBCX
1.85 + BCX
1.86 +
1.87 +/[^a]{2,3}/i
1.88 + abcdef
1.89 + ABCDEF
1.90 +
1.91 +/[^a]{2,3}?/i
1.92 + abcdef
1.93 + ABCDEF
1.94 +
1.95 +/[^a]{2,3}+/i
1.96 + abcdef
1.97 + ABCDEF
1.98 +
1.99 +/((a|)+)+Z/
1.100 + Z
1.101 +
1.102 +/(a)b|(a)c/
1.103 + ac
1.104 +
1.105 +/(?>(a))b|(a)c/
1.106 + ac
1.107 +
1.108 +/(?=(a))ab|(a)c/
1.109 + ac
1.110 +
1.111 +/((?>(a))b|(a)c)/
1.112 + ac
1.113 +
1.114 +/((?>(a))b|(a)c)++/
1.115 + ac
1.116 +
1.117 +/(?:(?>(a))b|(a)c)++/
1.118 + ac
1.119 +
1.120 +/(?=(?>(a))b|(a)c)(..)/
1.121 + ac
1.122 +
1.123 +/(?>(?>(a))b|(a)c)/
1.124 + ac
1.125 +
1.126 +/(?:(?>([ab])))+a=/+
1.127 + =ba=
1.128 +
1.129 +/(?>([ab]))+a=/+
1.130 + =ba=
1.131 +
1.132 +/((?>(a+)b)+(aabab))/
1.133 + aaaabaaabaabab
1.134 +
1.135 +/(?>a+|ab)+?c/
1.136 + aabc
1.137 +
1.138 +/(?>a+|ab)+c/
1.139 + aabc
1.140 +
1.141 +/(?:a+|ab)+c/
1.142 + aabc
1.143 +
1.144 +/(?(?=(a))a)/
1.145 + a
1.146 +
1.147 +/(?(?=(a))a)(b)/
1.148 + ab
1.149 +
1.150 +/^(?:a|ab)++c/
1.151 + aaaabc
1.152 +
1.153 +/^(?>a|ab)++c/
1.154 + aaaabc
1.155 +
1.156 +/^(?:a|ab)+c/
1.157 + aaaabc
1.158 +
1.159 +/(?=abc){3}abc/+
1.160 + abcabcabc
1.161 + ** Failers
1.162 + xyz
1.163 +
1.164 +/(?=abc)+abc/+
1.165 + abcabcabc
1.166 + ** Failers
1.167 + xyz
1.168 +
1.169 +/(?=abc)++abc/+
1.170 + abcabcabc
1.171 + ** Failers
1.172 + xyz
1.173 +
1.174 +/(?=abc){0}xyz/
1.175 + xyz
1.176 +
1.177 +/(?=abc){1}xyz/
1.178 + ** Failers
1.179 + xyz
1.180 +
1.181 +/(?=(a))?./
1.182 + ab
1.183 + bc
1.184 +
1.185 +/(?=(a))??./
1.186 + ab
1.187 + bc
1.188 +
1.189 +/^(?=(a)){0}b(?1)/
1.190 + backgammon
1.191 +
1.192 +/^(?=(?1))?[az]([abc])d/
1.193 + abd
1.194 + zcdxx
1.195 +
1.196 +/^(?!a){0}\w+/
1.197 + aaaaa
1.198 +
1.199 +/(?<=(abc))?xyz/
1.200 + abcxyz
1.201 + pqrxyz
1.202 +
1.203 +/^[\g<a>]+/
1.204 + ggg<<<aaa>>>
1.205 + ** Failers
1.206 + \\ga
1.207 +
1.208 +/^[\ga]+/
1.209 + gggagagaxyz
1.210 +
1.211 +/^[:a[:digit:]]+/
1.212 + aaaa444:::Z
1.213 +
1.214 +/^[:a[:digit:]:b]+/
1.215 + aaaa444:::bbbZ
1.216 +
1.217 +/[:a]xxx[b:]/
1.218 + :xxx:
1.219 +
1.220 +/(?<=a{2})b/i
1.221 + xaabc
1.222 + ** Failers
1.223 + xabc
1.224 +
1.225 +/(?<!a{2})b/i
1.226 + xabc
1.227 + ** Failers
1.228 + xaabc
1.229 +
1.230 +/(?<=a\h)c/
1.231 + xa c
1.232 +
1.233 +/(?<=[^a]{2})b/
1.234 + axxbc
1.235 + aAAbc
1.236 + ** Failers
1.237 + xaabc
1.238 +
1.239 +/(?<=[^a]{2})b/i
1.240 + axxbc
1.241 + ** Failers
1.242 + aAAbc
1.243 + xaabc
1.244 +
1.245 +/(?<=a\H)c/
1.246 + abc
1.247 +
1.248 +/(?<=a\V)c/
1.249 + abc
1.250 +
1.251 +/(?<=a\v)c/
1.252 + a\nc
1.253 +
1.254 +/(?(?=c)c|d)++Y/
1.255 + XcccddYX
1.256 +
1.257 +/(?(?=c)c|d)*+Y/
1.258 + XcccddYX
1.259 +
1.260 +/^(a{2,3}){2,}+a/
1.261 + aaaaaaa
1.262 + ** Failers
1.263 + aaaaaa
1.264 + aaaaaaaaa
1.265 +
1.266 +/^(a{2,3})++a/
1.267 + ** Failers
1.268 + aaaaaa
1.269 +
1.270 +/^(a{2,3})*+a/
1.271 + ** Failers
1.272 + aaaaaa
1.273 +
1.274 +/ab\Cde/
1.275 + abXde
1.276 +
1.277 +/(?<=ab\Cde)X/
1.278 + abZdeX
1.279 +
1.280 +/a[\CD]b/
1.281 + aCb
1.282 + aDb
1.283 +
1.284 +/a[\C-X]b/
1.285 + aJb
1.286 +
1.287 +/\H\h\V\v/
1.288 + X X\x0a
1.289 + X\x09X\x0b
1.290 + ** Failers
1.291 + \xa0 X\x0a
1.292 +
1.293 +/\H*\h+\V?\v{3,4}/
1.294 + \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
1.295 + \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
1.296 + \x09\x20\xa0\x0a\x0b\x0c
1.297 + ** Failers
1.298 + \x09\x20\xa0\x0a\x0b
1.299 +
1.300 +/\H{3,4}/
1.301 + XY ABCDE
1.302 + XY PQR ST
1.303 +
1.304 +/.\h{3,4}./
1.305 + XY AB PQRS
1.306 +
1.307 +/\h*X\h?\H+Y\H?Z/
1.308 + >XNNNYZ
1.309 + > X NYQZ
1.310 + ** Failers
1.311 + >XYZ
1.312 + > X NY Z
1.313 +
1.314 +/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
1.315 + >XY\x0aZ\x0aA\x0bNN\x0c
1.316 + >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
1.317 +
1.318 +/(foo)\Kbar/
1.319 + foobar
1.320 +
1.321 +/(foo)(\Kbar|baz)/
1.322 + foobar
1.323 + foobaz
1.324 +
1.325 +/(foo\Kbar)baz/
1.326 + foobarbaz
1.327 +
1.328 +/abc\K|def\K/g+
1.329 + Xabcdefghi
1.330 +
1.331 +/ab\Kc|de\Kf/g+
1.332 + Xabcdefghi
1.333 +
1.334 +/(?=C)/g+
1.335 + ABCDECBA
1.336 +
1.337 +/^abc\K/+
1.338 + abcdef
1.339 + ** Failers
1.340 + defabcxyz
1.341 +
1.342 +/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
1.343 + ababababbbabZXXXX
1.344 +
1.345 +/(?<A>tom|bon)-\g{A}/
1.346 + tom-tom
1.347 + bon-bon
1.348 +
1.349 +/(^(a|b\g{-1}))/
1.350 + bacxxx
1.351 +
1.352 +/(?|(abc)|(xyz))\1/
1.353 + abcabc
1.354 + xyzxyz
1.355 + ** Failers
1.356 + abcxyz
1.357 + xyzabc
1.358 +
1.359 +/(?|(abc)|(xyz))(?1)/
1.360 + abcabc
1.361 + xyzabc
1.362 + ** Failers
1.363 + xyzxyz
1.364 +
1.365 +/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
1.366 + XYabcdY
1.367 +
1.368 +/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
1.369 + XYabcdY
1.370 +
1.371 +/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
1.372 + XYabcdY
1.373 +
1.374 +/(?'abc'\w+):\k<abc>{2}/
1.375 + a:aaxyz
1.376 + ab:ababxyz
1.377 + ** Failers
1.378 + a:axyz
1.379 + ab:abxyz
1.380 +
1.381 +/(?'abc'\w+):\g{abc}{2}/
1.382 + a:aaxyz
1.383 + ab:ababxyz
1.384 + ** Failers
1.385 + a:axyz
1.386 + ab:abxyz
1.387 +
1.388 +/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
1.389 + abd
1.390 + ce
1.391 +
1.392 +/^(a.)\g-1Z/
1.393 + aXaXZ
1.394 +
1.395 +/^(a.)\g{-1}Z/
1.396 + aXaXZ
1.397 +
1.398 +/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
1.399 + abcd
1.400 +
1.401 +/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
1.402 + (?(DEFINE)
1.403 + (?<NAME_PAT>[a-z]+)
1.404 + (?<ADDRESS_PAT>\d+)
1.405 + )/x
1.406 + metcalfe 33
1.407 +
1.408 +/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
1.409 + 1.2.3.4
1.410 + 131.111.10.206
1.411 + 10.0.0.0
1.412 + ** Failers
1.413 + 10.6
1.414 + 455.3.4.5
1.415 +
1.416 +/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
1.417 + 1.2.3.4
1.418 + 131.111.10.206
1.419 + 10.0.0.0
1.420 + ** Failers
1.421 + 10.6
1.422 + 455.3.4.5
1.423 +
1.424 +/^(\w++|\s++)*$/
1.425 + now is the time for all good men to come to the aid of the party
1.426 + *** Failers
1.427 + this is not a line with only words and spaces!
1.428 +
1.429 +/(\d++)(\w)/
1.430 + 12345a
1.431 + *** Failers
1.432 + 12345+
1.433 +
1.434 +/a++b/
1.435 + aaab
1.436 +
1.437 +/(a++b)/
1.438 + aaab
1.439 +
1.440 +/(a++)b/
1.441 + aaab
1.442 +
1.443 +/([^()]++|\([^()]*\))+/
1.444 + ((abc(ade)ufh()()x
1.445 +
1.446 +/\(([^()]++|\([^()]+\))+\)/
1.447 + (abc)
1.448 + (abc(def)xyz)
1.449 + *** Failers
1.450 + ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
1.451 +
1.452 +/^([^()]|\((?1)*\))*$/
1.453 + abc
1.454 + a(b)c
1.455 + a(b(c))d
1.456 + *** Failers)
1.457 + a(b(c)d
1.458 +
1.459 +/^>abc>([^()]|\((?1)*\))*<xyz<$/
1.460 + >abc>123<xyz<
1.461 + >abc>1(2)3<xyz<
1.462 + >abc>(1(2)3)<xyz<
1.463 +
1.464 +/^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
1.465 + 1221
1.466 + Satanoscillatemymetallicsonatas
1.467 + AmanaplanacanalPanama
1.468 + AblewasIereIsawElba
1.469 + *** Failers
1.470 + Thequickbrownfox
1.471 +
1.472 +/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
1.473 + 12
1.474 + (((2+2)*-3)-7)
1.475 + -12
1.476 + *** Failers
1.477 + ((2+2)*-3)-7)
1.478 +
1.479 +/^(x(y|(?1){2})z)/
1.480 + xyz
1.481 + xxyzxyzz
1.482 + *** Failers
1.483 + xxyzz
1.484 + xxyzxyzxyzz
1.485 +
1.486 +/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
1.487 + <>
1.488 + <abcd>
1.489 + <abc <123> hij>
1.490 + <abc <def> hij>
1.491 + <abc<>def>
1.492 + <abc<>
1.493 + *** Failers
1.494 + <abc
1.495 +
1.496 +/^a+(*FAIL)/
1.497 + aaaaaa
1.498 +
1.499 +/a+b?c+(*FAIL)/
1.500 + aaabccc
1.501 +
1.502 +/a+b?(*PRUNE)c+(*FAIL)/
1.503 + aaabccc
1.504 +
1.505 +/a+b?(*COMMIT)c+(*FAIL)/
1.506 + aaabccc
1.507 +
1.508 +/a+b?(*SKIP)c+(*FAIL)/
1.509 + aaabcccaaabccc
1.510 +
1.511 +/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
1.512 + aaaxxxxxx
1.513 + aaa++++++
1.514 + bbbxxxxx
1.515 + bbb+++++
1.516 + cccxxxx
1.517 + ccc++++
1.518 + dddddddd
1.519 +
1.520 +/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
1.521 + aaaxxxxxx
1.522 + aaa++++++
1.523 + bbbxxxxx
1.524 + bbb+++++
1.525 + cccxxxx
1.526 + ccc++++
1.527 + dddddddd
1.528 +
1.529 +/a+b?(*THEN)c+(*FAIL)/
1.530 + aaabccc
1.531 +
1.532 +/(A (A|B(*ACCEPT)|C) D)(E)/x
1.533 + AB
1.534 + ABX
1.535 + AADE
1.536 + ACDE
1.537 + ** Failers
1.538 + AD
1.539 +
1.540 +/^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i
1.541 + 1221
1.542 + Satan, oscillate my metallic sonatas!
1.543 + A man, a plan, a canal: Panama!
1.544 + Able was I ere I saw Elba.
1.545 + *** Failers
1.546 + The quick brown fox
1.547 +
1.548 +/^((.)(?1)\2|.)$/
1.549 + a
1.550 + aba
1.551 + aabaa
1.552 + abcdcba
1.553 + pqaabaaqp
1.554 + ablewasiereisawelba
1.555 + rhubarb
1.556 + the quick brown fox
1.557 +
1.558 +/(a)(?<=b(?1))/
1.559 + baz
1.560 + ** Failers
1.561 + caz
1.562 +
1.563 +/(?<=b(?1))(a)/
1.564 + zbaaz
1.565 + ** Failers
1.566 + aaa
1.567 +
1.568 +/(?<X>a)(?<=b(?&X))/
1.569 + baz
1.570 +
1.571 +/^(?|(abc)|(def))\1/
1.572 + abcabc
1.573 + defdef
1.574 + ** Failers
1.575 + abcdef
1.576 + defabc
1.577 +
1.578 +/^(?|(abc)|(def))(?1)/
1.579 + abcabc
1.580 + defabc
1.581 + ** Failers
1.582 + defdef
1.583 + abcdef
1.584 +
1.585 +/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ
1.586 + a\"aaaaa
1.587 + b\"aaaaa
1.588 + ** Failers
1.589 + b\"11111
1.590 +
1.591 +/(?:(?1)|B)(A(*F)|C)/
1.592 + ABCD
1.593 + CCD
1.594 + ** Failers
1.595 + CAD
1.596 +
1.597 +/^(?:(?1)|B)(A(*F)|C)/
1.598 + CCD
1.599 + BCD
1.600 + ** Failers
1.601 + ABCD
1.602 + CAD
1.603 + BAD
1.604 +
1.605 +/(?:(?1)|B)(A(*ACCEPT)XX|C)D/
1.606 + AAD
1.607 + ACD
1.608 + BAD
1.609 + BCD
1.610 + BAX
1.611 + ** Failers
1.612 + ACX
1.613 + ABC
1.614 +
1.615 +/(?(DEFINE)(A))B(?1)C/
1.616 + BAC
1.617 +
1.618 +/(?(DEFINE)((A)\2))B(?1)C/
1.619 + BAAC
1.620 +
1.621 +/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x
1.622 + (ab(cd)ef)
1.623 +
1.624 +/^(?!a(*SKIP)b)/
1.625 + ac
1.626 +
1.627 +/^(?=a(*SKIP)b|ac)/
1.628 + ** Failers
1.629 + ac
1.630 +
1.631 +/^(?=a(*THEN)b|ac)/
1.632 + ac
1.633 +
1.634 +/^(?=a(*PRUNE)b)/
1.635 + ab
1.636 + ** Failers
1.637 + ac
1.638 +
1.639 +/^(?=a(*ACCEPT)b)/
1.640 + ac
1.641 +
1.642 +/^(?(?!a(*SKIP)b))/
1.643 + ac
1.644 +
1.645 +/(?>a\Kb)/
1.646 + ab
1.647 +
1.648 +/((?>a\Kb))/
1.649 + ab
1.650 +
1.651 +/(a\Kb)/
1.652 + ab
1.653 +
1.654 +/^a\Kcz|ac/
1.655 + ac
1.656 +
1.657 +/(?>a\Kbz|ab)/
1.658 + ab
1.659 +
1.660 +/^(?&t)(?(DEFINE)(?<t>a\Kb))$/
1.661 + ab
1.662 +
1.663 +/^([^()]|\((?1)*\))*$/
1.664 + a(b)c
1.665 + a(b(c)d)e
1.666 +
1.667 +/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
1.668 + 0
1.669 + 00
1.670 + 0000
1.671 +
1.672 +/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
1.673 + 0
1.674 + 00
1.675 + 0000
1.676 +
1.677 +/--- This one does fail, as expected, in Perl. It needs the complex item at the
1.678 + end of the pattern. A single letter instead of (B|D) makes it not fail,
1.679 + which I think is a Perl bug. --- /
1.680 +
1.681 +/A(*COMMIT)(B|D)/
1.682 + ACABX
1.683 +
1.684 +/--- Check the use of names for failure ---/
1.685 +
1.686 +/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
1.687 + ** Failers
1.688 + AC
1.689 + CB
1.690 +
1.691 +/--- Force no study, otherwise mark is not seen. The studied version is in
1.692 + test 2 because it isn't Perl-compatible. ---/
1.693 +
1.694 +/(*MARK:A)(*SKIP:B)(C|X)/KSS
1.695 + C
1.696 + D
1.697 +
1.698 +/^(A(*THEN:A)B|C(*THEN:B)D)/K
1.699 + ** Failers
1.700 + CB
1.701 +
1.702 +/^(?:A(*THEN:A)B|C(*THEN:B)D)/K
1.703 + CB
1.704 +
1.705 +/^(?>A(*THEN:A)B|C(*THEN:B)D)/K
1.706 + CB
1.707 +
1.708 +/--- This should succeed, as the skip causes bump to offset 1 (the mark). Note
1.709 +that we have to have something complicated such as (B|Z) at the end because,
1.710 +for Perl, a simple character somehow causes an unwanted optimization to mess
1.711 +with the handling of backtracking verbs. ---/
1.712 +
1.713 +/A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK
1.714 + AAAC
1.715 +
1.716 +/--- Test skipping over a non-matching mark. ---/
1.717 +
1.718 +/A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK
1.719 + AAAC
1.720 +
1.721 +/--- Check shorthand for MARK ---/
1.722 +
1.723 +/A(*:A)A+(*SKIP:A)(B|Z) | AC/xK
1.724 + AAAC
1.725 +
1.726 +/--- Don't loop! Force no study, otherwise mark is not seen. ---/
1.727 +
1.728 +/(*:A)A+(*SKIP:A)(B|Z)/KSS
1.729 + AAAC
1.730 +
1.731 +/--- This should succeed, as a non-existent skip name disables the skip ---/
1.732 +
1.733 +/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
1.734 + AAAC
1.735 +
1.736 +/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK
1.737 + AAAC
1.738 +
1.739 +/--- COMMIT at the start of a pattern should act like an anchor. Again,
1.740 +however, we need the complication for Perl. ---/
1.741 +
1.742 +/(*COMMIT)(A|P)(B|P)(C|P)/
1.743 + ABCDEFG
1.744 + ** Failers
1.745 + DEFGABC
1.746 +
1.747 +/--- COMMIT inside an atomic group can't stop backtracking over the group. ---/
1.748 +
1.749 +/(\w+)(?>b(*COMMIT))\w{2}/
1.750 + abbb
1.751 +
1.752 +/(\w+)b(*COMMIT)\w{2}/
1.753 + abbb
1.754 +
1.755 +/--- Check opening parens in comment when seeking forward reference. ---/
1.756 +
1.757 +/(?&t)(?#()(?(DEFINE)(?<t>a))/
1.758 + bac
1.759 +
1.760 +/--- COMMIT should override THEN ---/
1.761 +
1.762 +/(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/
1.763 + yes
1.764 +
1.765 +/(?>(*COMMIT)(yes|no)(*THEN)(*F))?/
1.766 + yes
1.767 +
1.768 +/b?(*SKIP)c/
1.769 + bc
1.770 + abc
1.771 +
1.772 +/(*SKIP)bc/
1.773 + a
1.774 +
1.775 +/(*SKIP)b/
1.776 + a
1.777 +
1.778 +/(?P<abn>(?P=abn)xxx|)+/
1.779 + xxx
1.780 +
1.781 +/(?i:([^b]))(?1)/
1.782 + aa
1.783 + aA
1.784 + ** Failers
1.785 + ab
1.786 + aB
1.787 + Ba
1.788 + ba
1.789 +
1.790 +/^(?&t)*+(?(DEFINE)(?<t>a))\w$/
1.791 + aaaaaaX
1.792 + ** Failers
1.793 + aaaaaa
1.794 +
1.795 +/^(?&t)*(?(DEFINE)(?<t>a))\w$/
1.796 + aaaaaaX
1.797 + aaaaaa
1.798 +
1.799 +/^(a)*+(\w)/
1.800 + aaaaX
1.801 + YZ
1.802 + ** Failers
1.803 + aaaa
1.804 +
1.805 +/^(?:a)*+(\w)/
1.806 + aaaaX
1.807 + YZ
1.808 + ** Failers
1.809 + aaaa
1.810 +
1.811 +/^(a)++(\w)/
1.812 + aaaaX
1.813 + ** Failers
1.814 + aaaa
1.815 + YZ
1.816 +
1.817 +/^(?:a)++(\w)/
1.818 + aaaaX
1.819 + ** Failers
1.820 + aaaa
1.821 + YZ
1.822 +
1.823 +/^(a)?+(\w)/
1.824 + aaaaX
1.825 + YZ
1.826 +
1.827 +/^(?:a)?+(\w)/
1.828 + aaaaX
1.829 + YZ
1.830 +
1.831 +/^(a){2,}+(\w)/
1.832 + aaaaX
1.833 + ** Failers
1.834 + aaa
1.835 + YZ
1.836 +
1.837 +/^(?:a){2,}+(\w)/
1.838 + aaaaX
1.839 + ** Failers
1.840 + aaa
1.841 + YZ
1.842 +
1.843 +/(a|)*(?1)b/
1.844 + b
1.845 + ab
1.846 + aab
1.847 +
1.848 +/(a)++(?1)b/
1.849 + ** Failers
1.850 + ab
1.851 + aab
1.852 +
1.853 +/(a)*+(?1)b/
1.854 + ** Failers
1.855 + ab
1.856 + aab
1.857 +
1.858 +/(?1)(?:(b)){0}/
1.859 + b
1.860 +
1.861 +/(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x
1.862 + foo(bar(baz)+baz(bop))
1.863 +
1.864 +/(A (A|B(*ACCEPT)|C) D)(E)/x
1.865 + AB
1.866 +
1.867 +/\A.*?(?:a|b(*THEN)c)/
1.868 + ba
1.869 +
1.870 +/\A.*?(?:a|bc)/
1.871 + ba
1.872 +
1.873 +/\A.*?(a|b(*THEN)c)/
1.874 + ba
1.875 +
1.876 +/\A.*?(a|bc)/
1.877 + ba
1.878 +
1.879 +/\A.*?(?:a|b(*THEN)c)++/
1.880 + ba
1.881 +
1.882 +/\A.*?(?:a|bc)++/
1.883 + ba
1.884 +
1.885 +/\A.*?(a|b(*THEN)c)++/
1.886 + ba
1.887 +
1.888 +/\A.*?(a|bc)++/
1.889 + ba
1.890 +
1.891 +/\A.*?(?:a|b(*THEN)c|d)/
1.892 + ba
1.893 +
1.894 +/\A.*?(?:a|bc|d)/
1.895 + ba
1.896 +
1.897 +/(?:(b))++/
1.898 + beetle
1.899 +
1.900 +/(?(?=(a(*ACCEPT)z))a)/
1.901 + a
1.902 +
1.903 +/^(a)(?1)+ab/
1.904 + aaaab
1.905 +
1.906 +/^(a)(?1)++ab/
1.907 + aaaab
1.908 +
1.909 +/^(?=a(*:M))aZ/K
1.910 + aZbc
1.911 +
1.912 +/^(?!(*:M)b)aZ/K
1.913 + aZbc
1.914 +
1.915 +/(?(DEFINE)(a))?b(?1)/
1.916 + backgammon
1.917 +
1.918 +/^\N+/
1.919 + abc\ndef
1.920 +
1.921 +/^\N{1,}/
1.922 + abc\ndef
1.923 +
1.924 +/(?(R)a+|(?R)b)/
1.925 + aaaabcde
1.926 +
1.927 +/(?(R)a+|((?R))b)/
1.928 + aaaabcde
1.929 +
1.930 +/((?(R)a+|(?1)b))/
1.931 + aaaabcde
1.932 +
1.933 +/((?(R1)a+|(?1)b))/
1.934 + aaaabcde
1.935 +
1.936 +/a(*:any
1.937 +name)/K
1.938 + abc
1.939 +
1.940 +/(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/
1.941 + a
1.942 + ba
1.943 + bba
1.944 +
1.945 +/--- Checking revised (*THEN) handling ---/
1.946 +
1.947 +/--- Capture ---/
1.948 +
1.949 +/^.*? (a(*THEN)b) c/x
1.950 + aabc
1.951 +
1.952 +/^.*? (a(*THEN)b|(*F)) c/x
1.953 + aabc
1.954 +
1.955 +/^.*? ( (a(*THEN)b) | (*F) ) c/x
1.956 + aabc
1.957 +
1.958 +/^.*? ( (a(*THEN)b) ) c/x
1.959 + aabc
1.960 +
1.961 +/--- Non-capture ---/
1.962 +
1.963 +/^.*? (?:a(*THEN)b) c/x
1.964 + aabc
1.965 +
1.966 +/^.*? (?:a(*THEN)b|(*F)) c/x
1.967 + aabc
1.968 +
1.969 +/^.*? (?: (?:a(*THEN)b) | (*F) ) c/x
1.970 + aabc
1.971 +
1.972 +/^.*? (?: (?:a(*THEN)b) ) c/x
1.973 + aabc
1.974 +
1.975 +/--- Atomic ---/
1.976 +
1.977 +/^.*? (?>a(*THEN)b) c/x
1.978 + aabc
1.979 +
1.980 +/^.*? (?>a(*THEN)b|(*F)) c/x
1.981 + aabc
1.982 +
1.983 +/^.*? (?> (?>a(*THEN)b) | (*F) ) c/x
1.984 + aabc
1.985 +
1.986 +/^.*? (?> (?>a(*THEN)b) ) c/x
1.987 + aabc
1.988 +
1.989 +/--- Possessive capture ---/
1.990 +
1.991 +/^.*? (a(*THEN)b)++ c/x
1.992 + aabc
1.993 +
1.994 +/^.*? (a(*THEN)b|(*F))++ c/x
1.995 + aabc
1.996 +
1.997 +/^.*? ( (a(*THEN)b)++ | (*F) )++ c/x
1.998 + aabc
1.999 +
1.1000 +/^.*? ( (a(*THEN)b)++ )++ c/x
1.1001 + aabc
1.1002 +
1.1003 +/--- Possessive non-capture ---/
1.1004 +
1.1005 +/^.*? (?:a(*THEN)b)++ c/x
1.1006 + aabc
1.1007 +
1.1008 +/^.*? (?:a(*THEN)b|(*F))++ c/x
1.1009 + aabc
1.1010 +
1.1011 +/^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x
1.1012 + aabc
1.1013 +
1.1014 +/^.*? (?: (?:a(*THEN)b)++ )++ c/x
1.1015 + aabc
1.1016 +
1.1017 +/--- Condition assertion ---/
1.1018 +
1.1019 +/^(?(?=a(*THEN)b)ab|ac)/
1.1020 + ac
1.1021 +
1.1022 +/--- Condition ---/
1.1023 +
1.1024 +/^.*?(?(?=a)a|b(*THEN)c)/
1.1025 + ba
1.1026 +
1.1027 +/^.*?(?:(?(?=a)a|b(*THEN)c)|d)/
1.1028 + ba
1.1029 +
1.1030 +/^.*?(?(?=a)a(*THEN)b|c)/
1.1031 + ac
1.1032 +
1.1033 +/--- Assertion ---/
1.1034 +
1.1035 +/^.*(?=a(*THEN)b)/
1.1036 + aabc
1.1037 +
1.1038 +/------------------------------/
1.1039 +
1.1040 +/(?>a(*:m))/imsxSK
1.1041 + a
1.1042 +
1.1043 +/(?>(a)(*:m))/imsxSK
1.1044 + a
1.1045 +
1.1046 +/(?<=a(*ACCEPT)b)c/
1.1047 + xacd
1.1048 +
1.1049 +/(?<=(a(*ACCEPT)b))c/
1.1050 + xacd
1.1051 +
1.1052 +/(?<=(a(*COMMIT)b))c/
1.1053 + xabcd
1.1054 + ** Failers
1.1055 + xacd
1.1056 +
1.1057 +/(?<!a(*FAIL)b)c/
1.1058 + xcd
1.1059 + acd
1.1060 +
1.1061 +/(?<=a(*:N)b)c/K
1.1062 + xabcd
1.1063 +
1.1064 +/(?<=a(*PRUNE)b)c/
1.1065 + xabcd
1.1066 +
1.1067 +/(?<=a(*SKIP)b)c/
1.1068 + xabcd
1.1069 +
1.1070 +/(?<=a(*THEN)b)c/
1.1071 + xabcd
1.1072 +
1.1073 +/(a)(?2){2}(.)/
1.1074 + abcd
1.1075 +
1.1076 +/(*MARK:A)(*PRUNE:B)(C|X)/KS
1.1077 + C
1.1078 + D
1.1079 +
1.1080 +/(*MARK:A)(*PRUNE:B)(C|X)/KSS
1.1081 + C
1.1082 + D
1.1083 +
1.1084 +/(*MARK:A)(*THEN:B)(C|X)/KS
1.1085 + C
1.1086 + D
1.1087 +
1.1088 +/(*MARK:A)(*THEN:B)(C|X)/KSY
1.1089 + C
1.1090 + D
1.1091 +
1.1092 +/(*MARK:A)(*THEN:B)(C|X)/KSS
1.1093 + C
1.1094 + D
1.1095 +
1.1096 +/--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/
1.1097 +
1.1098 +/A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK
1.1099 + AAAC
1.1100 +
1.1101 +/--- Same --/
1.1102 +
1.1103 +/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK
1.1104 + AAAC
1.1105 +
1.1106 +/A(*:A)A+(*SKIP)(B|Z) | AC/xK
1.1107 + AAAC
1.1108 +
1.1109 +/--- This should fail, as a null name is the same as no name ---/
1.1110 +
1.1111 +/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK
1.1112 + AAAC
1.1113 +
1.1114 +/--- A check on what happens after hitting a mark and them bumping along to
1.1115 +something that does not even start. Perl reports tags after the failures here,
1.1116 +though it does not when the individual letters are made into something
1.1117 +more complicated. ---/
1.1118 +
1.1119 +/A(*:A)B|XX(*:B)Y/K
1.1120 + AABC
1.1121 + XXYZ
1.1122 + ** Failers
1.1123 + XAQQ
1.1124 + XAQQXZZ
1.1125 + AXQQQ
1.1126 + AXXQQQ
1.1127 +
1.1128 +/^(A(*THEN:A)B|C(*THEN:B)D)/K
1.1129 + AB
1.1130 + CD
1.1131 + ** Failers
1.1132 + AC
1.1133 + CB
1.1134 +
1.1135 +/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
1.1136 + AB
1.1137 + CD
1.1138 + ** Failers
1.1139 + AC
1.1140 + CB
1.1141 +
1.1142 +/--- An empty name does not pass back an empty string. It is the same as if no
1.1143 +name were given. ---/
1.1144 +
1.1145 +/^(A(*PRUNE:)B|C(*PRUNE:B)D)/K
1.1146 + AB
1.1147 + CD
1.1148 +
1.1149 +/--- PRUNE goes to next bumpalong; COMMIT does not. ---/
1.1150 +
1.1151 +/A(*PRUNE:A)B/K
1.1152 + ACAB
1.1153 +
1.1154 +/--- Mark names can be duplicated ---/
1.1155 +
1.1156 +/A(*:A)B|X(*:A)Y/K
1.1157 + AABC
1.1158 + XXYZ
1.1159 +
1.1160 +/b(*:m)f|a(*:n)w/K
1.1161 + aw
1.1162 + ** Failers
1.1163 + abc
1.1164 +
1.1165 +/b(*:m)f|aw/K
1.1166 + abaw
1.1167 + ** Failers
1.1168 + abc
1.1169 + abax
1.1170 +
1.1171 +/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK
1.1172 + AAAC
1.1173 +
1.1174 +/a(*PRUNE:X)bc|qq/KY
1.1175 + ** Failers
1.1176 + axy
1.1177 +
1.1178 +/a(*THEN:X)bc|qq/KY
1.1179 + ** Failers
1.1180 + axy
1.1181 +
1.1182 +/(?=a(*MARK:A)b)..x/K
1.1183 + abxy
1.1184 + ** Failers
1.1185 + abpq
1.1186 +
1.1187 +/(?=a(*MARK:A)b)..(*:Y)x/K
1.1188 + abxy
1.1189 + ** Failers
1.1190 + abpq
1.1191 +
1.1192 +/(?=a(*PRUNE:A)b)..x/K
1.1193 + abxy
1.1194 + ** Failers
1.1195 + abpq
1.1196 +
1.1197 +/(?=a(*PRUNE:A)b)..(*:Y)x/K
1.1198 + abxy
1.1199 + ** Failers
1.1200 + abpq
1.1201 +
1.1202 +/(?=a(*THEN:A)b)..x/K
1.1203 + abxy
1.1204 + ** Failers
1.1205 + abpq
1.1206 +
1.1207 +/(?=a(*THEN:A)b)..(*:Y)x/K
1.1208 + abxy
1.1209 + ** Failers
1.1210 + abpq
1.1211 +
1.1212 +/(another)?(\1?)test/
1.1213 + hello world test
1.1214 +
1.1215 +/(another)?(\1+)test/
1.1216 + hello world test
1.1217 +
1.1218 +/(a(*COMMIT)b){0}a(?1)|aac/
1.1219 + aac
1.1220 +
1.1221 +/(?!a(*COMMIT)b)ac|cd/
1.1222 + ac
1.1223 +
1.1224 +/((?:a?)*)*c/
1.1225 + aac
1.1226 +
1.1227 +/((?>a?)*)*c/
1.1228 + aac
1.1229 +
1.1230 +/(?>.*?a)(?<=ba)/
1.1231 + aba
1.1232 +
1.1233 +/(?:.*?a)(?<=ba)/
1.1234 + aba
1.1235 +
1.1236 +/.*?a(*PRUNE)b/
1.1237 + aab
1.1238 +
1.1239 +/.*?a(*PRUNE)b/s
1.1240 + aab
1.1241 +
1.1242 +/^a(*PRUNE)b/s
1.1243 + aab
1.1244 +
1.1245 +/.*?a(*SKIP)b/
1.1246 + aab
1.1247 +
1.1248 +/(?>.*?a)b/s
1.1249 + aab
1.1250 +
1.1251 +/(?>.*?a)b/
1.1252 + aab
1.1253 +
1.1254 +/(?>^a)b/s
1.1255 + aab
1.1256 +
1.1257 +/(?>.*?)(?<=(abcd)|(wxyz))/
1.1258 + alphabetabcd
1.1259 + endingwxyz
1.1260 +
1.1261 +/(?>.*)(?<=(abcd)|(wxyz))/
1.1262 + alphabetabcd
1.1263 + endingwxyz
1.1264 +
1.1265 +"(?>.*)foo"
1.1266 + abcdfooxyz
1.1267 +
1.1268 +"(?>.*?)foo"
1.1269 + abcdfooxyz
1.1270 +
1.1271 +/-- End of testinput1 --/