| 1 |
|
/-- 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 |
| 5 |
X\x09X\x0b |
X\x09X\x0b |
| 252 |
** Failers |
** Failers |
| 253 |
AD |
AD |
| 254 |
|
|
| 255 |
/ End of testinput11 / |
/^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i |
| 256 |
|
1221 |
| 257 |
|
Satan, oscillate my metallic sonatas! |
| 258 |
|
A man, a plan, a canal: Panama! |
| 259 |
|
Able was I ere I saw Elba. |
| 260 |
|
*** Failers |
| 261 |
|
The quick brown fox |
| 262 |
|
|
| 263 |
|
/^((.)(?1)\2|.)$/ |
| 264 |
|
a |
| 265 |
|
aba |
| 266 |
|
aabaa |
| 267 |
|
abcdcba |
| 268 |
|
pqaabaaqp |
| 269 |
|
ablewasiereisawelba |
| 270 |
|
rhubarb |
| 271 |
|
the quick brown fox |
| 272 |
|
|
| 273 |
|
/(a)(?<=b(?1))/ |
| 274 |
|
baz |
| 275 |
|
** Failers |
| 276 |
|
caz |
| 277 |
|
|
| 278 |
|
/(?<=b(?1))(a)/ |
| 279 |
|
zbaaz |
| 280 |
|
** Failers |
| 281 |
|
aaa |
| 282 |
|
|
| 283 |
|
/(?<X>a)(?<=b(?&X))/ |
| 284 |
|
baz |
| 285 |
|
|
| 286 |
|
/^(?|(abc)|(def))\1/ |
| 287 |
|
abcabc |
| 288 |
|
defdef |
| 289 |
|
** Failers |
| 290 |
|
abcdef |
| 291 |
|
defabc |
| 292 |
|
|
| 293 |
|
/^(?|(abc)|(def))(?1)/ |
| 294 |
|
abcabc |
| 295 |
|
defabc |
| 296 |
|
** Failers |
| 297 |
|
defdef |
| 298 |
|
abcdef |
| 299 |
|
|
| 300 |
|
/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ |
| 301 |
|
a\"aaaaa |
| 302 |
|
b\"aaaaa |
| 303 |
|
** Failers |
| 304 |
|
b\"11111 |
| 305 |
|
|
| 306 |
|
/(?:(?1)|B)(A(*F)|C)/ |
| 307 |
|
ABCD |
| 308 |
|
CCD |
| 309 |
|
** Failers |
| 310 |
|
CAD |
| 311 |
|
|
| 312 |
|
/^(?:(?1)|B)(A(*F)|C)/ |
| 313 |
|
CCD |
| 314 |
|
BCD |
| 315 |
|
** Failers |
| 316 |
|
ABCD |
| 317 |
|
CAD |
| 318 |
|
BAD |
| 319 |
|
|
| 320 |
|
/(?:(?1)|B)(A(*ACCEPT)XX|C)D/ |
| 321 |
|
AAD |
| 322 |
|
ACD |
| 323 |
|
BAD |
| 324 |
|
BCD |
| 325 |
|
BAX |
| 326 |
|
** Failers |
| 327 |
|
ACX |
| 328 |
|
ABC |
| 329 |
|
|
| 330 |
|
/(?(DEFINE)(A))B(?1)C/ |
| 331 |
|
BAC |
| 332 |
|
|
| 333 |
|
/(?(DEFINE)((A)\2))B(?1)C/ |
| 334 |
|
BAAC |
| 335 |
|
|
| 336 |
|
/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x |
| 337 |
|
(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 |
|
/-- End of testinput11 --/ |