| 1 |
/-- These tests are for the Perl 5.10 features that PCRE supports. --/ |
/-- These tests are for the Perl >= 5.10 features that PCRE supports. --/ |
| 2 |
|
|
| 3 |
/\H\h\V\v/ |
/\H\h\V\v/ |
| 4 |
X X\x0a |
X X\x0a |
| 336 |
/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x |
/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x |
| 337 |
(ab(cd)ef) |
(ab(cd)ef) |
| 338 |
|
|
| 339 |
|
/^(?!a(*SKIP)b)/ |
| 340 |
|
ac |
| 341 |
|
|
| 342 |
|
/^(?=a(*SKIP)b|ac)/ |
| 343 |
|
** Failers |
| 344 |
|
ac |
| 345 |
|
|
| 346 |
|
/^(?=a(*THEN)b|ac)/ |
| 347 |
|
ac |
| 348 |
|
|
| 349 |
|
/^(?=a(*PRUNE)b)/ |
| 350 |
|
ab |
| 351 |
|
** Failers |
| 352 |
|
ac |
| 353 |
|
|
| 354 |
|
/^(?=a(*ACCEPT)b)/ |
| 355 |
|
ac |
| 356 |
|
|
| 357 |
|
/^(?(?!a(*SKIP)b))/ |
| 358 |
|
ac |
| 359 |
|
|
| 360 |
|
/(?>a\Kb)/ |
| 361 |
|
ab |
| 362 |
|
|
| 363 |
|
/((?>a\Kb))/ |
| 364 |
|
ab |
| 365 |
|
|
| 366 |
|
/(a\Kb)/ |
| 367 |
|
ab |
| 368 |
|
|
| 369 |
|
/^a\Kcz|ac/ |
| 370 |
|
ac |
| 371 |
|
|
| 372 |
|
/(?>a\Kbz|ab)/ |
| 373 |
|
ab |
| 374 |
|
|
| 375 |
|
/^(?&t)(?(DEFINE)(?<t>a\Kb))$/ |
| 376 |
|
ab |
| 377 |
|
|
| 378 |
|
/^([^()]|\((?1)*\))*$/ |
| 379 |
|
a(b)c |
| 380 |
|
a(b(c)d)e |
| 381 |
|
|
| 382 |
|
/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/ |
| 383 |
|
0 |
| 384 |
|
00 |
| 385 |
|
0000 |
| 386 |
|
|
| 387 |
|
/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/ |
| 388 |
|
0 |
| 389 |
|
00 |
| 390 |
|
0000 |
| 391 |
|
|
| 392 |
|
/--- This one does fail, as expected, in Perl. It needs the complex item at the |
| 393 |
|
end of the pattern. A single letter instead of (B|D) makes it not fail, |
| 394 |
|
which I think is a Perl bug. --- / |
| 395 |
|
|
| 396 |
|
/A(*COMMIT)(B|D)/ |
| 397 |
|
ACABX |
| 398 |
|
|
| 399 |
|
/--- Check the use of names for failure ---/ |
| 400 |
|
|
| 401 |
|
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K |
| 402 |
|
** Failers |
| 403 |
|
AC |
| 404 |
|
CB |
| 405 |
|
|
| 406 |
|
/(*MARK:A)(*SKIP:B)(C|X)/K |
| 407 |
|
C |
| 408 |
|
D |
| 409 |
|
|
| 410 |
|
/^(A(*THEN:A)B|C(*THEN:B)D)/K |
| 411 |
|
** Failers |
| 412 |
|
CB |
| 413 |
|
|
| 414 |
|
/^(?:A(*THEN:A)B|C(*THEN:B)D)/K |
| 415 |
|
CB |
| 416 |
|
|
| 417 |
|
/^(?>A(*THEN:A)B|C(*THEN:B)D)/K |
| 418 |
|
CB |
| 419 |
|
|
| 420 |
|
/--- This should succeed, as the skip causes bump to offset 1 (the mark). Note |
| 421 |
|
that we have to have something complicated such as (B|Z) at the end because, |
| 422 |
|
for Perl, a simple character somehow causes an unwanted optimization to mess |
| 423 |
|
with the handling of backtracking verbs. ---/ |
| 424 |
|
|
| 425 |
|
/A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK |
| 426 |
|
AAAC |
| 427 |
|
|
| 428 |
|
/--- Test skipping over a non-matching mark. ---/ |
| 429 |
|
|
| 430 |
|
/A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK |
| 431 |
|
AAAC |
| 432 |
|
|
| 433 |
|
/--- Check shorthand for MARK ---/ |
| 434 |
|
|
| 435 |
|
/A(*:A)A+(*SKIP:A)(B|Z) | AC/xK |
| 436 |
|
AAAC |
| 437 |
|
|
| 438 |
|
/--- Don't loop! ---/ |
| 439 |
|
|
| 440 |
|
/(*:A)A+(*SKIP:A)(B|Z)/K |
| 441 |
|
AAAC |
| 442 |
|
|
| 443 |
|
/--- This should succeed, as a non-existent skip name disables the skip ---/ |
| 444 |
|
|
| 445 |
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK |
| 446 |
|
AAAC |
| 447 |
|
|
| 448 |
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK |
| 449 |
|
AAAC |
| 450 |
|
|
| 451 |
|
/--- We use something more complicated than individual letters here, because |
| 452 |
|
that causes different behaviour in Perl. Perhaps it disables some optimization; |
| 453 |
|
anyway, the result now matches PCRE in that no tag is passed back for the |
| 454 |
|
failures. ---/ |
| 455 |
|
|
| 456 |
|
/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/xK |
| 457 |
|
AABC |
| 458 |
|
XXYZ |
| 459 |
|
** Failers |
| 460 |
|
XAQQ |
| 461 |
|
XAQQXZZ |
| 462 |
|
AXQQQ |
| 463 |
|
AXXQQQ |
| 464 |
|
|
| 465 |
|
/--- COMMIT at the start of a pattern should act like an anchor. Again, |
| 466 |
|
however, we need the complication for Perl. ---/ |
| 467 |
|
|
| 468 |
|
/(*COMMIT)(A|P)(B|P)(C|P)/ |
| 469 |
|
ABCDEFG |
| 470 |
|
** Failers |
| 471 |
|
DEFGABC |
| 472 |
|
|
| 473 |
|
/--- COMMIT inside an atomic group can't stop backtracking over the group. ---/ |
| 474 |
|
|
| 475 |
|
/(\w+)(?>b(*COMMIT))\w{2}/ |
| 476 |
|
abbb |
| 477 |
|
|
| 478 |
|
/(\w+)b(*COMMIT)\w{2}/ |
| 479 |
|
abbb |
| 480 |
|
|
| 481 |
|
/--- Check opening parens in comment when seeking forward reference. ---/ |
| 482 |
|
|
| 483 |
|
/(?&t)(?#()(?(DEFINE)(?<t>a))/ |
| 484 |
|
bac |
| 485 |
|
|
| 486 |
|
/--- COMMIT should override THEN ---/ |
| 487 |
|
|
| 488 |
|
/(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/ |
| 489 |
|
yes |
| 490 |
|
|
| 491 |
|
/(?>(*COMMIT)(yes|no)(*THEN)(*F))?/ |
| 492 |
|
yes |
| 493 |
|
|
| 494 |
|
/^((yes|no)(*THEN)(*F))?/ |
| 495 |
|
yes |
| 496 |
|
|
| 497 |
|
/b?(*SKIP)c/ |
| 498 |
|
bc |
| 499 |
|
abc |
| 500 |
|
|
| 501 |
|
/(*SKIP)bc/ |
| 502 |
|
a |
| 503 |
|
|
| 504 |
|
/(*SKIP)b/ |
| 505 |
|
a |
| 506 |
|
|
| 507 |
|
/(?P<abn>(?P=abn)xxx|)+/ |
| 508 |
|
xxx |
| 509 |
|
|
| 510 |
/-- End of testinput11 --/ |
/-- End of testinput11 --/ |