| 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. |
| 7 |
|
|
| 8 |
|
NOTE: This is a non-UTF set of tests. When UTF support is needed, use |
| 9 |
|
test 5, and if Unicode Property Support is needed, use test 7. --/ |
| 10 |
|
|
|
/-- Originally, the Perl >= 5.10 things were in here too, but now I have |
|
|
separated many (most?) of them out into test 11. However, there may still |
|
|
be some that were overlooked. --/ |
|
|
|
|
| 11 |
/(a)b|/I |
/(a)b|/I |
| 12 |
|
|
| 13 |
/abc/I |
/abc/I |
| 143 |
defabc |
defabc |
| 144 |
\Zdefabc |
\Zdefabc |
| 145 |
|
|
|
/abc/P |
|
|
abc |
|
|
*** Failers |
|
|
|
|
|
/^abc|def/P |
|
|
abcdef |
|
|
abcdef\B |
|
|
|
|
|
/.*((abc)$|(def))/P |
|
|
defabc |
|
|
\Zdefabc |
|
|
|
|
|
/the quick brown fox/P |
|
|
the quick brown fox |
|
|
*** Failers |
|
|
The Quick Brown Fox |
|
|
|
|
|
/the quick brown fox/Pi |
|
|
the quick brown fox |
|
|
The Quick Brown Fox |
|
|
|
|
|
/abc.def/P |
|
|
*** Failers |
|
|
abc\ndef |
|
|
|
|
|
/abc$/P |
|
|
abc |
|
|
abc\n |
|
|
|
|
|
/(abc)\2/P |
|
|
|
|
|
/(abc\1)/P |
|
|
abc |
|
|
|
|
| 146 |
/)/ |
/)/ |
| 147 |
|
|
| 148 |
/a[]b/ |
/a[]b/ |
| 407 |
|
|
| 408 |
/abc/\ |
/abc/\ |
| 409 |
|
|
|
/abc/\P |
|
|
|
|
| 410 |
/abc/\i |
/abc/\i |
| 411 |
|
|
| 412 |
/(a)bc(d)/I |
/(a)bc(d)/I |
| 454 |
/\Biss\B/I+ |
/\Biss\B/I+ |
| 455 |
Mississippi |
Mississippi |
| 456 |
|
|
|
/\Biss\B/I+P |
|
|
Mississippi |
|
|
|
|
| 457 |
/iss/IG+ |
/iss/IG+ |
| 458 |
Mississippi |
Mississippi |
| 459 |
|
|
| 589 |
*** Failers |
*** Failers |
| 590 |
\Nabc |
\Nabc |
| 591 |
|
|
|
/a*(b+)(z)(z)/P |
|
|
aaaabbbbzzzz |
|
|
aaaabbbbzzzz\O0 |
|
|
aaaabbbbzzzz\O1 |
|
|
aaaabbbbzzzz\O2 |
|
|
aaaabbbbzzzz\O3 |
|
|
aaaabbbbzzzz\O4 |
|
|
aaaabbbbzzzz\O5 |
|
|
|
|
| 592 |
/^.?abcd/IS |
/^.?abcd/IS |
| 593 |
|
|
| 594 |
/\( # ( at start |
/\( # ( at start |
| 1442 |
** Failers |
** Failers |
| 1443 |
line one\nthis is a line\nbreak in the second line |
line one\nthis is a line\nbreak in the second line |
| 1444 |
|
|
|
/ab.cd/P |
|
|
ab-cd |
|
|
ab=cd |
|
|
** Failers |
|
|
ab\ncd |
|
|
|
|
|
/ab.cd/Ps |
|
|
ab-cd |
|
|
ab=cd |
|
|
ab\ncd |
|
|
|
|
| 1445 |
/(?i)(?-i)AbCd/I |
/(?i)(?-i)AbCd/I |
| 1446 |
AbCd |
AbCd |
| 1447 |
** Failers |
** Failers |
| 1492 |
(this) |
(this) |
| 1493 |
((this)) |
((this)) |
| 1494 |
|
|
|
/a(b)c/PN |
|
|
abc |
|
|
|
|
|
/a(?P<name>b)c/PN |
|
|
abc |
|
|
|
|
|
/\x{100}/I |
|
|
|
|
| 1495 |
/\x{0000ff}/I |
/\x{0000ff}/I |
| 1496 |
|
|
| 1497 |
/^((?P<A>a1)|(?P<A>a2)b)/I |
/^((?P<A>a1)|(?P<A>a2)b)/I |
| 1569 |
/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I |
/()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I |
| 1570 |
bXXaYYaY |
bXXaYYaY |
| 1571 |
|
|
|
/\777/I |
|
|
|
|
| 1572 |
/\s*,\s*/IS |
/\s*,\s*/IS |
| 1573 |
\x0b,\x0b |
\x0b,\x0b |
| 1574 |
\x0c,\x0d |
\x0c,\x0d |
| 2171 |
xabcpqrx |
xabcpqrx |
| 2172 |
xxyzx |
xxyzx |
| 2173 |
|
|
|
/[\h]/BZ |
|
|
>\x09< |
|
|
|
|
|
/[\h]+/BZ |
|
|
>\x09\x20\xa0< |
|
|
|
|
|
/[\v]/BZ |
|
|
|
|
|
/[\H]/BZ |
|
|
|
|
|
/[^\h]/BZ |
|
|
|
|
|
/[\V]/BZ |
|
|
|
|
|
/[\x0a\V]/BZ |
|
|
|
|
| 2174 |
/\H++X/BZ |
/\H++X/BZ |
| 2175 |
** Failers |
** Failers |
| 2176 |
XXXX |
XXXX |
| 2530 |
|
|
| 2531 |
/(?(?=.*b).*b|^d)/I |
/(?(?=.*b).*b|^d)/I |
| 2532 |
|
|
|
/a?|b?/P |
|
|
abc |
|
|
** Failers |
|
|
ddd\N |
|
|
|
|
| 2533 |
/xyz/C |
/xyz/C |
| 2534 |
xyz |
xyz |
| 2535 |
abcxyz |
abcxyz |
| 2721 |
abc\P |
abc\P |
| 2722 |
abc\P\P |
abc\P\P |
| 2723 |
|
|
|
/\w+A/P |
|
|
CDAAAAB |
|
|
|
|
|
/\w+A/PU |
|
|
CDAAAAB |
|
|
|
|
| 2724 |
/abc\K123/ |
/abc\K123/ |
| 2725 |
xyzabc123pqr |
xyzabc123pqr |
| 2726 |
xyzabc12\P |
xyzabc12\P |
| 2864 |
|
|
| 2865 |
/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/SI |
/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/SI |
| 2866 |
|
|
|
/ (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* # optional leading comment |
|
|
(?: (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| |
|
|
" (?: # opening quote... |
|
|
[^\\\x80-\xff\n\015"] # Anything except backslash and quote |
|
|
| # or |
|
|
\\ [^\x80-\xff] # Escaped something (something != CR) |
|
|
)* " # closing quote |
|
|
) # initial word |
|
|
(?: (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* \. (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| |
|
|
" (?: # opening quote... |
|
|
[^\\\x80-\xff\n\015"] # Anything except backslash and quote |
|
|
| # or |
|
|
\\ [^\x80-\xff] # Escaped something (something != CR) |
|
|
)* " # closing quote |
|
|
) )* # further okay, if led by a period |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* @ (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # initial subdomain |
|
|
(?: # |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* \. # if led by a period... |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # ...further okay |
|
|
)* |
|
|
# address |
|
|
| # or |
|
|
(?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| |
|
|
" (?: # opening quote... |
|
|
[^\\\x80-\xff\n\015"] # Anything except backslash and quote |
|
|
| # or |
|
|
\\ [^\x80-\xff] # Escaped something (something != CR) |
|
|
)* " # closing quote |
|
|
) # one word, optionally followed by.... |
|
|
(?: |
|
|
[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or... |
|
|
\( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) | # comments, or... |
|
|
|
|
|
" (?: # opening quote... |
|
|
[^\\\x80-\xff\n\015"] # Anything except backslash and quote |
|
|
| # or |
|
|
\\ [^\x80-\xff] # Escaped something (something != CR) |
|
|
)* " # closing quote |
|
|
# quoted strings |
|
|
)* |
|
|
< (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* # leading < |
|
|
(?: @ (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # initial subdomain |
|
|
(?: # |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* \. # if led by a period... |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # ...further okay |
|
|
)* |
|
|
|
|
|
(?: (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* , (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* @ (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # initial subdomain |
|
|
(?: # |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* \. # if led by a period... |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # ...further okay |
|
|
)* |
|
|
)* # further okay, if led by comma |
|
|
: # closing colon |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* )? # optional route |
|
|
(?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| |
|
|
" (?: # opening quote... |
|
|
[^\\\x80-\xff\n\015"] # Anything except backslash and quote |
|
|
| # or |
|
|
\\ [^\x80-\xff] # Escaped something (something != CR) |
|
|
)* " # closing quote |
|
|
) # initial word |
|
|
(?: (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* \. (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| |
|
|
" (?: # opening quote... |
|
|
[^\\\x80-\xff\n\015"] # Anything except backslash and quote |
|
|
| # or |
|
|
\\ [^\x80-\xff] # Escaped something (something != CR) |
|
|
)* " # closing quote |
|
|
) )* # further okay, if led by a period |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* @ (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # initial subdomain |
|
|
(?: # |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* \. # if led by a period... |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* (?: |
|
|
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... |
|
|
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom |
|
|
| \[ # [ |
|
|
(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff |
|
|
\] # ] |
|
|
) # ...further okay |
|
|
)* |
|
|
# address spec |
|
|
(?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* > # trailing > |
|
|
# name and address |
|
|
) (?: [\040\t] | \( |
|
|
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* |
|
|
\) )* # optional trailing comment |
|
|
/xSI |
|
|
|
|
| 2867 |
/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/isIS |
/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/isIS |
| 2868 |
|
|
| 2869 |
"(?>.*/)foo"SI |
"(?>.*/)foo"SI |
| 3030 |
/A(*PRUNE)B|A(*PRUNE)C/K |
/A(*PRUNE)B|A(*PRUNE)C/K |
| 3031 |
AC |
AC |
| 3032 |
|
|
|
/--- A whole lot of tests of verbs with arguments are here rather than in test |
|
|
11 because Perl doesn't seem to follow its specification entirely |
|
|
correctly. ---/ |
|
|
|
|
|
/--- Perl 5.11 sets $REGERROR on the AC failure case here; PCRE does not. It is |
|
|
not clear how Perl defines "involved in the failure of the match". ---/ |
|
|
|
|
|
/^(A(*THEN:A)B|C(*THEN:B)D)/K |
|
|
AB |
|
|
CD |
|
|
** Failers |
|
|
AC |
|
|
CB |
|
|
|
|
|
/--- Check the use of names for success and failure. PCRE doesn't show these |
|
|
names for success, though Perl does, contrary to its spec. ---/ |
|
|
|
|
|
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K |
|
|
AB |
|
|
CD |
|
|
** Failers |
|
|
AC |
|
|
CB |
|
|
|
|
|
/--- An empty name does not pass back an empty string. It is the same as if no |
|
|
name were given. ---/ |
|
|
|
|
|
/^(A(*PRUNE:)B|C(*PRUNE:B)D)/K |
|
|
AB |
|
|
CD |
|
|
|
|
|
/--- PRUNE goes to next bumpalong; COMMIT does not. ---/ |
|
|
|
|
|
/A(*PRUNE:A)B/K |
|
|
ACAB |
|
|
|
|
|
/(*MARK:A)(*PRUNE:B)(C|X)/KS |
|
|
C |
|
|
D |
|
|
|
|
|
/(*MARK:A)(*PRUNE:B)(C|X)/KSS |
|
|
C |
|
|
D |
|
|
|
|
|
/(*MARK:A)(*THEN:B)(C|X)/KS |
|
|
C |
|
|
D |
|
|
|
|
|
/(*MARK:A)(*THEN:B)(C|X)/KSS |
|
|
C |
|
|
D |
|
|
|
|
|
/--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/ |
|
|
|
|
|
/A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK |
|
|
AAAC |
|
|
|
|
|
/--- Same --/ |
|
|
|
|
|
/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK |
|
|
AAAC |
|
|
|
|
| 3033 |
/--- 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 |
| 3034 |
PRUNE kills it. ---/ |
PRUNE kills it. Perl behaves differently. ---/ |
| 3035 |
|
|
| 3036 |
/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK |
/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK |
| 3037 |
AAAC |
AAAC |
| 3038 |
|
|
| 3039 |
/A(*:A)A+(*SKIP)(B|Z) | AC/xK |
/--- Mark names can be duplicated. Perl doesn't give a mark for this one, |
| 3040 |
AAAC |
though PCRE does. ---/ |
|
|
|
|
/--- This should fail, as a null name is the same as no name ---/ |
|
|
|
|
|
/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK |
|
|
AAAC |
|
|
|
|
|
/--- This fails in PCRE, and I think that is in accordance with Perl's |
|
|
documentation, though in Perl it succeeds. ---/ |
|
|
|
|
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK |
|
|
AAAC |
|
|
|
|
|
/--- Mark names can be duplicated ---/ |
|
| 3041 |
|
|
|
/A(*:A)B|X(*:A)Y/K |
|
|
AABC |
|
|
XXYZ |
|
|
|
|
| 3042 |
/^A(*:A)B|^X(*:A)Y/K |
/^A(*:A)B|^X(*:A)Y/K |
| 3043 |
** Failers |
** Failers |
| 3044 |
XAQQ |
XAQQ |
| 3045 |
|
|
|
/--- A check on what happens after hitting a mark and them bumping along to |
|
|
something that does not even start. Perl reports tags after the failures here, |
|
|
though it does not when the individual letters are made into something |
|
|
more complicated. ---/ |
|
|
|
|
|
/A(*:A)B|XX(*:B)Y/K |
|
|
AABC |
|
|
XXYZ |
|
|
** Failers |
|
|
XAQQ |
|
|
XAQQXZZ |
|
|
AXQQQ |
|
|
AXXQQQ |
|
|
|
|
| 3046 |
/--- 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 |
| 3047 |
optimizations defeat this. So does the PCRE optimization unless we disable it |
optimizations defeat this. So does the PCRE optimization unless we disable it |
| 3048 |
with \Y. ---/ |
with \Y. ---/ |
| 3052 |
** Failers |
** Failers |
| 3053 |
DEFGABC\Y |
DEFGABC\Y |
| 3054 |
|
|
|
/--- Repeat some tests with added studying. ---/ |
|
|
|
|
|
/A(*COMMIT)B/+KS |
|
|
ACABX |
|
|
|
|
|
/A(*THEN)B|A(*THEN)C/KS |
|
|
AC |
|
|
|
|
|
/A(*PRUNE)B|A(*PRUNE)C/KS |
|
|
AC |
|
|
|
|
|
/^(A(*THEN:A)B|C(*THEN:B)D)/KS |
|
|
AB |
|
|
CD |
|
|
** Failers |
|
|
AC |
|
|
CB |
|
|
|
|
|
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/KS |
|
|
AB |
|
|
CD |
|
|
** Failers |
|
|
AC |
|
|
CB |
|
|
|
|
|
/^(A(*PRUNE:)B|C(*PRUNE:B)D)/KS |
|
|
AB |
|
|
CD |
|
|
|
|
|
/A(*PRUNE:A)B/KS |
|
|
ACAB |
|
|
|
|
|
/(*MARK:A)(*PRUNE:B)(C|X)/KS |
|
|
C |
|
|
D |
|
|
|
|
|
/(*MARK:A)(*THEN:B)(C|X)/KS |
|
|
C |
|
|
D |
|
|
|
|
|
/A(*MARK:A)A+(*SKIP)(B|Z) | AC/xKS |
|
|
AAAC |
|
|
|
|
|
/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xKS |
|
|
AAAC |
|
|
|
|
|
/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xKS |
|
|
AAAC |
|
|
|
|
|
/A(*:A)A+(*SKIP)(B|Z) | AC/xKS |
|
|
AAAC |
|
|
|
|
|
/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xKS |
|
|
AAAC |
|
|
|
|
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xKS |
|
|
AAAC |
|
|
|
|
|
/A(*:A)B|XX(*:B)Y/KS |
|
|
AABC |
|
|
XXYZ |
|
|
** Failers |
|
|
XAQQ |
|
|
XAQQXZZ |
|
|
AXQQQ |
|
|
AXXQQQ |
|
|
|
|
|
/(*COMMIT)ABC/ |
|
|
ABCDEFG |
|
|
** Failers |
|
|
DEFGABC\Y |
|
|
|
|
| 3055 |
/^(ab (c+(*THEN)cd) | xyz)/x |
/^(ab (c+(*THEN)cd) | xyz)/x |
| 3056 |
abcccd |
abcccd |
| 3057 |
|
|
| 3102 |
/\d*\R/BZ |
/\d*\R/BZ |
| 3103 |
|
|
| 3104 |
/\s*\R/BZ |
/\s*\R/BZ |
| 3105 |
|
\x20\x0a |
| 3106 |
|
\x20\x0d |
| 3107 |
|
\x20\x0d\x0a |
| 3108 |
|
|
| 3109 |
|
/\S*\R/BZ |
| 3110 |
|
a\x0a |
| 3111 |
|
|
| 3112 |
|
/X\h*\R/BZ |
| 3113 |
|
X\x20\x0a |
| 3114 |
|
|
| 3115 |
|
/X\H*\R/BZ |
| 3116 |
|
X\x0d\x0a |
| 3117 |
|
|
| 3118 |
|
/X\H+\R/BZ |
| 3119 |
|
X\x0d\x0a |
| 3120 |
|
|
| 3121 |
|
/X\H++\R/BZ |
| 3122 |
|
X\x0d\x0a |
| 3123 |
|
|
| 3124 |
/-- Perl treats this one differently, not failing the second string. I believe |
/-- Perl treats this one differently, not failing the second string. I believe |
| 3125 |
that is a bug in Perl. --/ |
that is a bug in Perl. --/ |
| 3302 |
|
|
| 3303 |
/^.*?(a(*THEN)b)c/ |
/^.*?(a(*THEN)b)c/ |
| 3304 |
aabc |
aabc |
| 3305 |
|
|
| 3306 |
|
/^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x |
| 3307 |
|
aabc |
| 3308 |
|
|
| 3309 |
/^.*?(a(*THEN)b|z)c/ |
/^.*?(a(*THEN)b|z)c/ |
| 3310 |
aabc |
aabc |
| 3407 |
/((?2))((?1))/SS |
/((?2))((?1))/SS |
| 3408 |
abc |
abc |
| 3409 |
|
|
| 3410 |
/((?(R2)a+|(?1)b))/ |
/((?(R2)a+|(?1)b))/SS |
| 3411 |
aaaabcde |
aaaabcde |
| 3412 |
|
|
| 3413 |
/(?(R)a*(?1)|((?R))b)/ |
/(?(R)a*(?1)|((?R))b)/SS |
| 3414 |
aaaabcde |
aaaabcde |
| 3415 |
|
|
| 3416 |
/(a+|(?R)b)/ |
/(a+|(?R)b)/ |
| 3444 |
/z(*ACCEPT)a/+I |
/z(*ACCEPT)a/+I |
| 3445 |
baxzbx |
baxzbx |
| 3446 |
|
|
| 3447 |
|
/a(?:.)*?a/ims |
| 3448 |
|
\Mabbbbbbbbbbbbbbbbbbbbba |
| 3449 |
|
|
| 3450 |
|
/a(?:.(*THEN))*?a/ims |
| 3451 |
|
\Mabbbbbbbbbbbbbbbbbbbbba |
| 3452 |
|
|
| 3453 |
|
/a(?:.(*THEN:ABC))*?a/ims |
| 3454 |
|
\Mabbbbbbbbbbbbbbbbbbbbba |
| 3455 |
|
|
| 3456 |
|
/-- These tests are in agreement with development Perl 5.015, which has fixed |
| 3457 |
|
some things, but they don't all work with 5.012, so they aren't in the |
| 3458 |
|
Perl-compatible tests. Those after the first come from Perl's own test |
| 3459 |
|
files. --/ |
| 3460 |
|
|
| 3461 |
|
/^((yes|no)(*THEN)(*F))?/ |
| 3462 |
|
yes |
| 3463 |
|
|
| 3464 |
|
/(A (.*) C? (*THEN) | A D) (*FAIL)/x |
| 3465 |
|
AbcdCBefgBhiBqz |
| 3466 |
|
|
| 3467 |
|
/(A (.*) C? (*THEN) | A D) z/x |
| 3468 |
|
AbcdCBefgBhiBqz |
| 3469 |
|
|
| 3470 |
|
/(A (.*) C? (*THEN) | A D) \s* (*FAIL)/x |
| 3471 |
|
AbcdCBefgBhiBqz |
| 3472 |
|
|
| 3473 |
|
/(A (.*) C? (*THEN) | A D) \s* z/x |
| 3474 |
|
AbcdCBefgBhiBqz |
| 3475 |
|
|
| 3476 |
|
/(A (.*) (?:C|) (*THEN) | A D) (*FAIL)/x |
| 3477 |
|
AbcdCBefgBhiBqz |
| 3478 |
|
|
| 3479 |
|
/(A (.*) (?:C|) (*THEN) | A D) z/x |
| 3480 |
|
AbcdCBefgBhiBqz |
| 3481 |
|
|
| 3482 |
|
/(A (.*) C{0,6} (*THEN) | A D) (*FAIL)/x |
| 3483 |
|
AbcdCBefgBhiBqz |
| 3484 |
|
|
| 3485 |
|
/(A (.*) C{0,6} (*THEN) | A D) z/x |
| 3486 |
|
AbcdCBefgBhiBqz |
| 3487 |
|
|
| 3488 |
|
/(A (.*) (CE){0,6} (*THEN) | A D) (*FAIL)/x |
| 3489 |
|
AbcdCEBefgBhiBqz |
| 3490 |
|
|
| 3491 |
|
/(A (.*) (CE){0,6} (*THEN) | A D) z/x |
| 3492 |
|
AbcdCEBefgBhiBqz |
| 3493 |
|
|
| 3494 |
|
/(A (.*) (CE*){0,6} (*THEN) | A D) (*FAIL)/x |
| 3495 |
|
AbcdCBefgBhiBqz |
| 3496 |
|
|
| 3497 |
|
/(A (.*) (CE*){0,6} (*THEN) | A D) z/x |
| 3498 |
|
AbcdCBefgBhiBqz |
| 3499 |
|
|
| 3500 |
|
/-----------------------------------------------/ |
| 3501 |
|
|
| 3502 |
|
/^(?>a+)(?>(z+))\w/BZ |
| 3503 |
|
aaaazzzzb |
| 3504 |
|
** Failers |
| 3505 |
|
aazz |
| 3506 |
|
|
| 3507 |
|
/(.)(\1|a(?2))/ |
| 3508 |
|
bab |
| 3509 |
|
|
| 3510 |
|
/\1|(.)(?R)\1/ |
| 3511 |
|
cbbbc |
| 3512 |
|
|
| 3513 |
|
/(.)((?(1)c|a)|a(?2))/ |
| 3514 |
|
baa |
| 3515 |
|
|
| 3516 |
|
/(?P<abn>(?P=abn)xxx)/BZ |
| 3517 |
|
|
| 3518 |
|
/(a\1z)/BZ |
| 3519 |
|
|
| 3520 |
|
/^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/ |
| 3521 |
|
\Maabbccddee |
| 3522 |
|
|
| 3523 |
|
/^(?>(a+))(?>(b+))(?>(c+))(?>(d+))(?>(e+))/ |
| 3524 |
|
\Maabbccddee |
| 3525 |
|
|
| 3526 |
|
/^(?>(a+))(?>b+)(?>(c+))(?>d+)(?>(e+))/ |
| 3527 |
|
\Maabbccddee |
| 3528 |
|
|
| 3529 |
|
/^a\x41z/<JS> |
| 3530 |
|
aAz |
| 3531 |
|
*** Failers |
| 3532 |
|
ax41z |
| 3533 |
|
|
| 3534 |
|
/^a[m\x41]z/<JS> |
| 3535 |
|
aAz |
| 3536 |
|
|
| 3537 |
|
/^a\x1z/<JS> |
| 3538 |
|
ax1z |
| 3539 |
|
|
| 3540 |
|
/^a\u0041z/<JS> |
| 3541 |
|
aAz |
| 3542 |
|
*** Failers |
| 3543 |
|
au0041z |
| 3544 |
|
|
| 3545 |
|
/^a[m\u0041]z/<JS> |
| 3546 |
|
aAz |
| 3547 |
|
|
| 3548 |
|
/^a\u041z/<JS> |
| 3549 |
|
au041z |
| 3550 |
|
*** Failers |
| 3551 |
|
aAz |
| 3552 |
|
|
| 3553 |
|
/^a\U0041z/<JS> |
| 3554 |
|
aU0041z |
| 3555 |
|
*** Failers |
| 3556 |
|
aAz |
| 3557 |
|
|
| 3558 |
|
/(?(?=c)c|d)++Y/BZ |
| 3559 |
|
|
| 3560 |
|
/(?(?=c)c|d)*+Y/BZ |
| 3561 |
|
|
| 3562 |
|
/a[\NB]c/ |
| 3563 |
|
aNc |
| 3564 |
|
|
| 3565 |
|
/a[B-\Nc]/ |
| 3566 |
|
|
| 3567 |
|
/(a)(?2){0,1999}?(b)/ |
| 3568 |
|
|
| 3569 |
|
/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/ |
| 3570 |
|
|
| 3571 |
|
/--- This test, with something more complicated than individual letters, causes |
| 3572 |
|
different behaviour in Perl. Perhaps it disables some optimization; no tag is |
| 3573 |
|
passed back for the failures, whereas in PCRE there is a tag. ---/ |
| 3574 |
|
|
| 3575 |
|
/(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/xK |
| 3576 |
|
AABC |
| 3577 |
|
XXYZ |
| 3578 |
|
** Failers |
| 3579 |
|
XAQQ |
| 3580 |
|
XAQQXZZ |
| 3581 |
|
AXQQQ |
| 3582 |
|
AXXQQQ |
| 3583 |
|
|
| 3584 |
|
/-- Perl doesn't give marks for these, though it does if the alternatives are |
| 3585 |
|
replaced by single letters. --/ |
| 3586 |
|
|
| 3587 |
|
/(b|q)(*:m)f|a(*:n)w/K |
| 3588 |
|
aw |
| 3589 |
|
** Failers |
| 3590 |
|
abc |
| 3591 |
|
|
| 3592 |
|
/(q|b)(*:m)f|a(*:n)w/K |
| 3593 |
|
aw |
| 3594 |
|
** Failers |
| 3595 |
|
abc |
| 3596 |
|
|
| 3597 |
|
/-- After a partial match, the behaviour is as for a failure. --/ |
| 3598 |
|
|
| 3599 |
|
/^a(*:X)bcde/K |
| 3600 |
|
abc\P |
| 3601 |
|
|
| 3602 |
|
/-- These are here because Perl doesn't return a mark, except for the first --/ |
| 3603 |
|
|
| 3604 |
|
/(?=(*:x))(q|)/K+ |
| 3605 |
|
abc |
| 3606 |
|
|
| 3607 |
|
/(?=(*:x))((*:y)q|)/K+ |
| 3608 |
|
abc |
| 3609 |
|
|
| 3610 |
|
/(?=(*:x))(?:(*:y)q|)/K+ |
| 3611 |
|
abc |
| 3612 |
|
|
| 3613 |
|
/(?=(*:x))(?>(*:y)q|)/K+ |
| 3614 |
|
abc |
| 3615 |
|
|
| 3616 |
|
/(?=a(*:x))(?!a(*:y)c)/K+ |
| 3617 |
|
ab |
| 3618 |
|
|
| 3619 |
|
/(?=a(*:x))(?=a(*:y)c|)/K+ |
| 3620 |
|
ab |
| 3621 |
|
|
| 3622 |
|
/(..)\1/ |
| 3623 |
|
ab\P |
| 3624 |
|
aba\P |
| 3625 |
|
abab\P |
| 3626 |
|
|
| 3627 |
|
/(..)\1/i |
| 3628 |
|
ab\P |
| 3629 |
|
abA\P |
| 3630 |
|
aBAb\P |
| 3631 |
|
|
| 3632 |
|
/(..)\1{2,}/ |
| 3633 |
|
ab\P |
| 3634 |
|
aba\P |
| 3635 |
|
abab\P |
| 3636 |
|
ababa\P |
| 3637 |
|
ababab\P |
| 3638 |
|
ababab\P\P |
| 3639 |
|
abababa\P |
| 3640 |
|
abababa\P\P |
| 3641 |
|
|
| 3642 |
|
/(..)\1{2,}/i |
| 3643 |
|
ab\P |
| 3644 |
|
aBa\P |
| 3645 |
|
aBAb\P |
| 3646 |
|
AbaBA\P |
| 3647 |
|
abABAb\P |
| 3648 |
|
aBAbaB\P\P |
| 3649 |
|
abABabA\P |
| 3650 |
|
abaBABa\P\P |
| 3651 |
|
|
| 3652 |
|
/(..)\1{2,}?x/i |
| 3653 |
|
ab\P |
| 3654 |
|
abA\P |
| 3655 |
|
aBAb\P |
| 3656 |
|
abaBA\P |
| 3657 |
|
abAbaB\P |
| 3658 |
|
abaBabA\P |
| 3659 |
|
abAbABaBx\P |
| 3660 |
|
|
| 3661 |
|
/^(..)\1/ |
| 3662 |
|
aba\P |
| 3663 |
|
|
| 3664 |
|
/^(..)\1{2,3}x/ |
| 3665 |
|
aba\P |
| 3666 |
|
ababa\P |
| 3667 |
|
ababa\P\P |
| 3668 |
|
abababx |
| 3669 |
|
ababababx |
| 3670 |
|
|
| 3671 |
|
/^(..)\1{2,3}?x/ |
| 3672 |
|
aba\P |
| 3673 |
|
ababa\P |
| 3674 |
|
ababa\P\P |
| 3675 |
|
abababx |
| 3676 |
|
ababababx |
| 3677 |
|
|
| 3678 |
|
/^(..)(\1{2,3})ab/ |
| 3679 |
|
abababab |
| 3680 |
|
|
| 3681 |
|
/^\R/ |
| 3682 |
|
\r\P |
| 3683 |
|
\r\P\P |
| 3684 |
|
|
| 3685 |
|
/^\R{2,3}x/ |
| 3686 |
|
\r\P |
| 3687 |
|
\r\P\P |
| 3688 |
|
\r\r\P |
| 3689 |
|
\r\r\P\P |
| 3690 |
|
\r\r\r\P |
| 3691 |
|
\r\r\r\P\P |
| 3692 |
|
\r\rx |
| 3693 |
|
\r\r\rx |
| 3694 |
|
|
| 3695 |
|
/^\R{2,3}?x/ |
| 3696 |
|
\r\P |
| 3697 |
|
\r\P\P |
| 3698 |
|
\r\r\P |
| 3699 |
|
\r\r\P\P |
| 3700 |
|
\r\r\r\P |
| 3701 |
|
\r\r\r\P\P |
| 3702 |
|
\r\rx |
| 3703 |
|
\r\r\rx |
| 3704 |
|
|
| 3705 |
|
/^\R?x/ |
| 3706 |
|
\r\P |
| 3707 |
|
\r\P\P |
| 3708 |
|
x |
| 3709 |
|
\rx |
| 3710 |
|
|
| 3711 |
|
/^\R+x/ |
| 3712 |
|
\r\P |
| 3713 |
|
\r\P\P |
| 3714 |
|
\r\n\P |
| 3715 |
|
\r\n\P\P |
| 3716 |
|
\rx |
| 3717 |
|
|
| 3718 |
|
/^a$/<CRLF> |
| 3719 |
|
a\r\P |
| 3720 |
|
a\r\P\P |
| 3721 |
|
|
| 3722 |
|
/^a$/m<CRLF> |
| 3723 |
|
a\r\P |
| 3724 |
|
a\r\P\P |
| 3725 |
|
|
| 3726 |
|
/^(a$|a\r)/<CRLF> |
| 3727 |
|
a\r\P |
| 3728 |
|
a\r\P\P |
| 3729 |
|
|
| 3730 |
|
/^(a$|a\r)/m<CRLF> |
| 3731 |
|
a\r\P |
| 3732 |
|
a\r\P\P |
| 3733 |
|
|
| 3734 |
|
/./<CRLF> |
| 3735 |
|
\r\P |
| 3736 |
|
\r\P\P |
| 3737 |
|
|
| 3738 |
|
/.{2,3}/<CRLF> |
| 3739 |
|
\r\P |
| 3740 |
|
\r\P\P |
| 3741 |
|
\r\r\P |
| 3742 |
|
\r\r\P\P |
| 3743 |
|
\r\r\r\P |
| 3744 |
|
\r\r\r\P\P |
| 3745 |
|
|
| 3746 |
|
/.{2,3}?/<CRLF> |
| 3747 |
|
\r\P |
| 3748 |
|
\r\P\P |
| 3749 |
|
\r\r\P |
| 3750 |
|
\r\r\P\P |
| 3751 |
|
\r\r\r\P |
| 3752 |
|
\r\r\r\P\P |
| 3753 |
|
|
| 3754 |
|
/-- These two are here because Perl does not match: it seems to allow the |
| 3755 |
|
COMMIT to escape from the assertion. --/ |
| 3756 |
|
|
| 3757 |
|
/(?=a(*COMMIT)b|ac)ac|ac/ |
| 3758 |
|
ac |
| 3759 |
|
|
| 3760 |
|
/(?=a(*COMMIT)b|(ac)) ac | (a)c/x |
| 3761 |
|
ac |
| 3762 |
|
|
| 3763 |
|
"AB(C(D))(E(F))?(?(?=\2)(?=\4))" |
| 3764 |
|
ABCDGHI\O03 |
| 3765 |
|
|
| 3766 |
/-- End of testinput2 --/ |
/-- End of testinput2 --/ |