version 1.1.1.1, 2012/02/21 23:05:52
|
version 1.1.1.5, 2014/06/15 19:46:05
|
Line 1
|
Line 1
|
/-- This set of tests is for features that are compatible with all versions of |
/-- This set of tests is for features that are compatible with all versions of |
Perl 5, in non-UTF-8 mode. --/ | Perl >= 5.10, in non-UTF-8 mode. It should run clean for the 8-bit, 16-bit, |
| and 32-bit PCRE libraries. --/ |
| |
| < forbid 89?=ABCDEFfGILMNPTUWXZ< |
|
|
/the quick brown fox/ |
/the quick brown fox/ |
the quick brown fox |
the quick brown fox |
Line 2148 No match
|
Line 2151 No match
|
abc\100\60 |
abc\100\60 |
0: abc@0 |
0: abc@0 |
1: abc |
1: abc |
|
|
|
/^A\8B\9C$/ |
|
A8B9C |
|
0: A8B9C |
|
*** Failers |
|
No match |
|
A\08B\09C |
|
No match |
|
|
|
/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/ |
|
ABCDEFGHIHI |
|
0: ABCDEFGHIHI |
|
1: A |
|
2: B |
|
3: C |
|
4: D |
|
5: E |
|
6: F |
|
7: G |
|
8: H |
|
9: I |
|
|
/abc\81/ | /^[A\8B\9C]+$/ |
abc\081 | A8B9C |
0: abc\x0081 | 0: A8B9C |
abc\0\x38\x31 | *** Failers |
0: abc\x0081 | No match |
| A8B9C\x00 |
| No match |
|
|
/abc\91/ |
|
abc\091 |
|
0: abc\x0091 |
|
abc\0\x39\x31 |
|
0: abc\x0091 |
|
|
|
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/ |
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/ |
abcdefghijkllS |
abcdefghijkllS |
0: abcdefghijkllS |
0: abcdefghijkllS |
Line 5971 No match
|
Line 5991 No match
|
0: |
0: |
0: |
0: |
|
|
/^[a-\d]/ |
|
abcde |
|
0: a |
|
-things |
|
0: - |
|
0digit |
|
0: 0 |
|
*** Failers |
|
No match |
|
bcdef |
|
No match |
|
|
|
/^[\d-a]/ |
/^[\d-a]/ |
abcde |
abcde |
0: a |
0: a |
Line 6005 No match
|
Line 6013 No match
|
|
|
/[\s]+/ |
/[\s]+/ |
> \x09\x0a\x0c\x0d\x0b< |
> \x09\x0a\x0c\x0d\x0b< |
0: \x09\x0a\x0c\x0d | 0: \x09\x0a\x0c\x0d\x0b |
|
|
/\s+/ |
/\s+/ |
> \x09\x0a\x0c\x0d\x0b< |
> \x09\x0a\x0c\x0d\x0b< |
0: \x09\x0a\x0c\x0d | 0: \x09\x0a\x0c\x0d\x0b |
|
|
/ab/x |
/ab/x |
ab |
ab |
No match | 0: ab |
|
|
/(?!\A)x/m |
/(?!\A)x/m |
a\nxb\n |
a\nxb\n |
Line 6159 No match
|
Line 6167 No match
|
1: bc |
1: bc |
2: bc |
2: bc |
|
|
/-- This tests for an IPv6 address in the form where it can have up to --/ | /-- This tests for an IPv6 address in the form where it can have up to |
/-- eight components, one and only one of which is empty. This must be --/ | eight components, one and only one of which is empty. This must be |
No match | an internal component. --/ |
/-- an internal component. --/ | |
No match | |
|
|
/^(?!:) # colon disallowed at start |
/^(?!:) # colon disallowed at start |
(?: # start of item |
(?: # start of item |
Line 6905 No match
|
Line 6911 No match
|
bc |
bc |
0: b |
0: b |
|
|
/^(?=(a)){0}b(?1)/ |
|
backgammon |
|
0: ba |
|
|
|
/^(?=(?1))?[az]([abc])d/ |
/^(?=(?1))?[az]([abc])d/ |
abd |
abd |
0: abd |
0: abd |
Line 7052 No match
|
Line 7054 No match
|
/a[\C-X]b/ |
/a[\C-X]b/ |
aJb |
aJb |
0: aJb |
0: aJb |
|
|
|
/\H\h\V\v/ |
|
X X\x0a |
|
0: X X\x0a |
|
X\x09X\x0b |
|
0: X\x09X\x0b |
|
** Failers |
|
No match |
|
\xa0 X\x0a |
|
No match |
|
|
|
/\H*\h+\V?\v{3,4}/ |
|
\x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a |
|
0: \x09 \xa0X\x0a\x0b\x0c\x0d |
|
\x09\x20\xa0\x0a\x0b\x0c\x0d\x0a |
|
0: \x09 \xa0\x0a\x0b\x0c\x0d |
|
\x09\x20\xa0\x0a\x0b\x0c |
|
0: \x09 \xa0\x0a\x0b\x0c |
|
** Failers |
|
No match |
|
\x09\x20\xa0\x0a\x0b |
|
No match |
|
|
|
/\H{3,4}/ |
|
XY ABCDE |
|
0: ABCD |
|
XY PQR ST |
|
0: PQR |
|
|
|
/.\h{3,4}./ |
|
XY AB PQRS |
|
0: B P |
|
|
|
/\h*X\h?\H+Y\H?Z/ |
|
>XNNNYZ |
|
0: XNNNYZ |
|
> X NYQZ |
|
0: X NYQZ |
|
** Failers |
|
No match |
|
>XYZ |
|
No match |
|
> X NY Z |
|
No match |
|
|
|
/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/ |
|
>XY\x0aZ\x0aA\x0bNN\x0c |
|
0: XY\x0aZ\x0aA\x0bNN\x0c |
|
>\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c |
|
0: \x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c |
|
|
|
/(foo)\Kbar/ |
|
foobar |
|
0: bar |
|
1: foo |
|
|
|
/(foo)(\Kbar|baz)/ |
|
foobar |
|
0: bar |
|
1: foo |
|
2: bar |
|
foobaz |
|
0: foobaz |
|
1: foo |
|
2: baz |
|
|
|
/(foo\Kbar)baz/ |
|
foobarbaz |
|
0: barbaz |
|
1: foobar |
|
|
|
/abc\K|def\K/g+ |
|
Xabcdefghi |
|
0: |
|
0+ defghi |
|
0: |
|
0+ ghi |
|
|
|
/ab\Kc|de\Kf/g+ |
|
Xabcdefghi |
|
0: c |
|
0+ defghi |
|
0: f |
|
0+ ghi |
|
|
|
/(?=C)/g+ |
|
ABCDECBA |
|
0: |
|
0+ CDECBA |
|
0: |
|
0+ CBA |
|
|
|
/^abc\K/+ |
|
abcdef |
|
0: |
|
0+ def |
|
** Failers |
|
No match |
|
defabcxyz |
|
No match |
|
|
|
/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/ |
|
ababababbbabZXXXX |
|
0: ababababbbabZ |
|
1: ab |
|
2: b |
|
|
|
/(?<A>tom|bon)-\g{A}/ |
|
tom-tom |
|
0: tom-tom |
|
1: tom |
|
bon-bon |
|
0: bon-bon |
|
1: bon |
|
|
|
/(^(a|b\g{-1}))/ |
|
bacxxx |
|
No match |
|
|
|
/(?|(abc)|(xyz))\1/ |
|
abcabc |
|
0: abcabc |
|
1: abc |
|
xyzxyz |
|
0: xyzxyz |
|
1: xyz |
|
** Failers |
|
No match |
|
abcxyz |
|
No match |
|
xyzabc |
|
No match |
|
|
|
/(?|(abc)|(xyz))(?1)/ |
|
abcabc |
|
0: abcabc |
|
1: abc |
|
xyzabc |
|
0: xyzabc |
|
1: xyz |
|
** Failers |
|
No match |
|
xyzxyz |
|
No match |
|
|
|
/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/ |
|
XYabcdY |
|
0: XYabcdY |
|
1: a |
|
2: b |
|
3: c |
|
4: d |
|
5: Y |
|
|
|
/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/ |
|
XYabcdY |
|
0: XYabcdY |
|
1: a |
|
2: b |
|
3: <unset> |
|
4: <unset> |
|
5: c |
|
6: d |
|
7: Y |
|
|
|
/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/ |
|
XYabcdY |
|
0: XYabcdY |
|
1: a |
|
2: b |
|
3: <unset> |
|
4: <unset> |
|
5: c |
|
6: d |
|
7: Y |
|
|
|
/(?'abc'\w+):\k<abc>{2}/ |
|
a:aaxyz |
|
0: a:aa |
|
1: a |
|
ab:ababxyz |
|
0: ab:abab |
|
1: ab |
|
** Failers |
|
No match |
|
a:axyz |
|
No match |
|
ab:abxyz |
|
No match |
|
|
|
/(?'abc'\w+):\g{abc}{2}/ |
|
a:aaxyz |
|
0: a:aa |
|
1: a |
|
ab:ababxyz |
|
0: ab:abab |
|
1: ab |
|
** Failers |
|
No match |
|
a:axyz |
|
No match |
|
ab:abxyz |
|
No match |
|
|
|
/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x |
|
abd |
|
0: abd |
|
1: a |
|
ce |
|
0: ce |
|
|
|
/^(a.)\g-1Z/ |
|
aXaXZ |
|
0: aXaXZ |
|
1: aX |
|
|
|
/^(a.)\g{-1}Z/ |
|
aXaXZ |
|
0: aXaXZ |
|
1: aX |
|
|
|
/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x |
|
abcd |
|
0: ab |
|
|
|
/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT)) |
|
(?(DEFINE) |
|
(?<NAME_PAT>[a-z]+) |
|
(?<ADDRESS_PAT>\d+) |
|
)/x |
|
metcalfe 33 |
|
0: metcalfe 33 |
|
1: metcalfe |
|
2: 33 |
|
|
|
/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/ |
|
1.2.3.4 |
|
0: 1.2.3.4 |
|
1: <unset> |
|
2: .4 |
|
131.111.10.206 |
|
0: 131.111.10.206 |
|
1: <unset> |
|
2: .206 |
|
10.0.0.0 |
|
0: 10.0.0.0 |
|
1: <unset> |
|
2: .0 |
|
** Failers |
|
No match |
|
10.6 |
|
No match |
|
455.3.4.5 |
|
No match |
|
|
|
/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/ |
|
1.2.3.4 |
|
0: 1.2.3.4 |
|
1: .4 |
|
131.111.10.206 |
|
0: 131.111.10.206 |
|
1: .206 |
|
10.0.0.0 |
|
0: 10.0.0.0 |
|
1: .0 |
|
** Failers |
|
No match |
|
10.6 |
|
No match |
|
455.3.4.5 |
|
No match |
|
|
|
/^(\w++|\s++)*$/ |
|
now is the time for all good men to come to the aid of the party |
|
0: now is the time for all good men to come to the aid of the party |
|
1: party |
|
*** Failers |
|
No match |
|
this is not a line with only words and spaces! |
|
No match |
|
|
|
/(\d++)(\w)/ |
|
12345a |
|
0: 12345a |
|
1: 12345 |
|
2: a |
|
*** Failers |
|
No match |
|
12345+ |
|
No match |
|
|
|
/a++b/ |
|
aaab |
|
0: aaab |
|
|
|
/(a++b)/ |
|
aaab |
|
0: aaab |
|
1: aaab |
|
|
|
/(a++)b/ |
|
aaab |
|
0: aaab |
|
1: aaa |
|
|
|
/([^()]++|\([^()]*\))+/ |
|
((abc(ade)ufh()()x |
|
0: abc(ade)ufh()()x |
|
1: x |
|
|
|
/\(([^()]++|\([^()]+\))+\)/ |
|
(abc) |
|
0: (abc) |
|
1: abc |
|
(abc(def)xyz) |
|
0: (abc(def)xyz) |
|
1: xyz |
|
*** Failers |
|
No match |
|
((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
|
No match |
|
|
|
/^([^()]|\((?1)*\))*$/ |
|
abc |
|
0: abc |
|
1: c |
|
a(b)c |
|
0: a(b)c |
|
1: c |
|
a(b(c))d |
|
0: a(b(c))d |
|
1: d |
|
*** Failers) |
|
No match |
|
a(b(c)d |
|
No match |
|
|
|
/^>abc>([^()]|\((?1)*\))*<xyz<$/ |
|
>abc>123<xyz< |
|
0: >abc>123<xyz< |
|
1: 3 |
|
>abc>1(2)3<xyz< |
|
0: >abc>1(2)3<xyz< |
|
1: 3 |
|
>abc>(1(2)3)<xyz< |
|
0: >abc>(1(2)3)<xyz< |
|
1: (1(2)3) |
|
|
|
/^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i |
|
1221 |
|
0: 1221 |
|
1: 1221 |
|
2: 1 |
|
Satanoscillatemymetallicsonatas |
|
0: Satanoscillatemymetallicsonatas |
|
1: <unset> |
|
2: <unset> |
|
3: Satanoscillatemymetallicsonatas |
|
4: S |
|
AmanaplanacanalPanama |
|
0: AmanaplanacanalPanama |
|
1: <unset> |
|
2: <unset> |
|
3: AmanaplanacanalPanama |
|
4: A |
|
AblewasIereIsawElba |
|
0: AblewasIereIsawElba |
|
1: <unset> |
|
2: <unset> |
|
3: AblewasIereIsawElba |
|
4: A |
|
*** Failers |
|
No match |
|
Thequickbrownfox |
|
No match |
|
|
|
/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/ |
|
12 |
|
0: 12 |
|
1: 12 |
|
(((2+2)*-3)-7) |
|
0: (((2+2)*-3)-7) |
|
1: (((2+2)*-3)-7) |
|
2: - |
|
-12 |
|
0: -12 |
|
1: -12 |
|
*** Failers |
|
No match |
|
((2+2)*-3)-7) |
|
No match |
|
|
|
/^(x(y|(?1){2})z)/ |
|
xyz |
|
0: xyz |
|
1: xyz |
|
2: y |
|
xxyzxyzz |
|
0: xxyzxyzz |
|
1: xxyzxyzz |
|
2: xyzxyz |
|
*** Failers |
|
No match |
|
xxyzz |
|
No match |
|
xxyzxyzxyzz |
|
No match |
|
|
|
/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x |
|
<> |
|
0: <> |
|
1: <> |
|
2: <> |
|
<abcd> |
|
0: <abcd> |
|
1: <abcd> |
|
2: <abcd> |
|
<abc <123> hij> |
|
0: <abc <123> hij> |
|
1: <abc <123> hij> |
|
2: <abc <123> hij> |
|
<abc <def> hij> |
|
0: <def> |
|
1: <def> |
|
2: <def> |
|
<abc<>def> |
|
0: <abc<>def> |
|
1: <abc<>def> |
|
2: <abc<>def> |
|
<abc<> |
|
0: <> |
|
1: <> |
|
2: <> |
|
*** Failers |
|
No match |
|
<abc |
|
No match |
|
|
|
/^a+(*FAIL)/ |
|
aaaaaa |
|
No match |
|
|
|
/a+b?c+(*FAIL)/ |
|
aaabccc |
|
No match |
|
|
|
/a+b?(*PRUNE)c+(*FAIL)/ |
|
aaabccc |
|
No match |
|
|
|
/a+b?(*COMMIT)c+(*FAIL)/ |
|
aaabccc |
|
No match |
|
|
|
/a+b?(*SKIP)c+(*FAIL)/ |
|
aaabcccaaabccc |
|
No match |
|
|
|
/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/ |
|
aaaxxxxxx |
|
0: aaaxxxxxx |
|
aaa++++++ |
|
0: aaa |
|
bbbxxxxx |
|
0: bbbxxxxx |
|
bbb+++++ |
|
0: bbb |
|
cccxxxx |
|
0: cccxxxx |
|
ccc++++ |
|
0: ccc |
|
dddddddd |
|
0: ddd |
|
|
|
/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/ |
|
aaaxxxxxx |
|
0: aaaxxxxxx |
|
1: aaaxxxxxx |
|
aaa++++++ |
|
0: aaa |
|
1: aaa |
|
bbbxxxxx |
|
0: bbbxxxxx |
|
1: bbbxxxxx |
|
bbb+++++ |
|
0: bbb |
|
1: bbb |
|
cccxxxx |
|
0: cccxxxx |
|
1: cccxxxx |
|
ccc++++ |
|
0: ccc |
|
1: ccc |
|
dddddddd |
|
0: ddd |
|
1: ddd |
|
|
|
/a+b?(*THEN)c+(*FAIL)/ |
|
aaabccc |
|
No match |
|
|
|
/(A (A|B(*ACCEPT)|C) D)(E)/x |
|
AB |
|
0: AB |
|
1: AB |
|
2: B |
|
ABX |
|
0: AB |
|
1: AB |
|
2: B |
|
AADE |
|
0: AADE |
|
1: AAD |
|
2: A |
|
3: E |
|
ACDE |
|
0: ACDE |
|
1: ACD |
|
2: C |
|
3: E |
|
** Failers |
|
No match |
|
AD |
|
No match |
|
|
|
/^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i |
|
1221 |
|
0: 1221 |
|
1: 1221 |
|
2: 1 |
|
Satan, oscillate my metallic sonatas! |
|
0: Satan, oscillate my metallic sonatas! |
|
1: <unset> |
|
2: <unset> |
|
3: Satan, oscillate my metallic sonatas |
|
4: S |
|
A man, a plan, a canal: Panama! |
|
0: A man, a plan, a canal: Panama! |
|
1: <unset> |
|
2: <unset> |
|
3: A man, a plan, a canal: Panama |
|
4: A |
|
Able was I ere I saw Elba. |
|
0: Able was I ere I saw Elba. |
|
1: <unset> |
|
2: <unset> |
|
3: Able was I ere I saw Elba |
|
4: A |
|
*** Failers |
|
No match |
|
The quick brown fox |
|
No match |
|
|
|
/^((.)(?1)\2|.)$/ |
|
a |
|
0: a |
|
1: a |
|
aba |
|
0: aba |
|
1: aba |
|
2: a |
|
aabaa |
|
0: aabaa |
|
1: aabaa |
|
2: a |
|
abcdcba |
|
0: abcdcba |
|
1: abcdcba |
|
2: a |
|
pqaabaaqp |
|
0: pqaabaaqp |
|
1: pqaabaaqp |
|
2: p |
|
ablewasiereisawelba |
|
0: ablewasiereisawelba |
|
1: ablewasiereisawelba |
|
2: a |
|
rhubarb |
|
No match |
|
the quick brown fox |
|
No match |
|
|
|
/(a)(?<=b(?1))/ |
|
baz |
|
0: a |
|
1: a |
|
** Failers |
|
No match |
|
caz |
|
No match |
|
|
|
/(?<=b(?1))(a)/ |
|
zbaaz |
|
0: a |
|
1: a |
|
** Failers |
|
No match |
|
aaa |
|
No match |
|
|
|
/(?<X>a)(?<=b(?&X))/ |
|
baz |
|
0: a |
|
1: a |
|
|
|
/^(?|(abc)|(def))\1/ |
|
abcabc |
|
0: abcabc |
|
1: abc |
|
defdef |
|
0: defdef |
|
1: def |
|
** Failers |
|
No match |
|
abcdef |
|
No match |
|
defabc |
|
No match |
|
|
|
/^(?|(abc)|(def))(?1)/ |
|
abcabc |
|
0: abcabc |
|
1: abc |
|
defabc |
|
0: defabc |
|
1: def |
|
** Failers |
|
No match |
|
defdef |
|
No match |
|
abcdef |
|
No match |
|
|
|
/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ |
|
a\"aaaaa |
|
0: a"aaaaa |
|
1: " |
|
2: <unset> |
|
3: " |
|
b\"aaaaa |
|
0: b"aaaaa |
|
1: <unset> |
|
2: <unset> |
|
3: <unset> |
|
4: " |
|
5: <unset> |
|
6: " |
|
** Failers |
|
No match |
|
b\"11111 |
|
No match |
|
|
|
/(?:(?1)|B)(A(*F)|C)/ |
|
ABCD |
|
0: BC |
|
1: C |
|
CCD |
|
0: CC |
|
1: C |
|
** Failers |
|
No match |
|
CAD |
|
No match |
|
|
|
/^(?:(?1)|B)(A(*F)|C)/ |
|
CCD |
|
0: CC |
|
1: C |
|
BCD |
|
0: BC |
|
1: C |
|
** Failers |
|
No match |
|
ABCD |
|
No match |
|
CAD |
|
No match |
|
BAD |
|
No match |
|
|
|
/(?:(?1)|B)(A(*ACCEPT)XX|C)D/ |
|
AAD |
|
0: AA |
|
1: A |
|
ACD |
|
0: ACD |
|
1: C |
|
BAD |
|
0: BA |
|
1: A |
|
BCD |
|
0: BCD |
|
1: C |
|
BAX |
|
0: BA |
|
1: A |
|
** Failers |
|
No match |
|
ACX |
|
No match |
|
ABC |
|
No match |
|
|
|
/(?(DEFINE)(A))B(?1)C/ |
|
BAC |
|
0: BAC |
|
|
|
/(?(DEFINE)((A)\2))B(?1)C/ |
|
BAAC |
|
0: BAAC |
|
|
|
/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x |
|
(ab(cd)ef) |
|
0: (ab(cd)ef) |
|
1: (ab(cd)ef) |
|
2: ef |
|
|
|
/^(?=a(*SKIP)b|ac)/ |
|
** Failers |
|
No match |
|
ac |
|
No match |
|
|
|
/^(?=a(*PRUNE)b)/ |
|
ab |
|
0: |
|
** Failers |
|
No match |
|
ac |
|
No match |
|
|
|
/^(?=a(*ACCEPT)b)/ |
|
ac |
|
0: |
|
|
|
/(?>a\Kb)/ |
|
ab |
|
0: b |
|
|
|
/((?>a\Kb))/ |
|
ab |
|
0: b |
|
1: ab |
|
|
|
/(a\Kb)/ |
|
ab |
|
0: b |
|
1: ab |
|
|
|
/^a\Kcz|ac/ |
|
ac |
|
0: ac |
|
|
|
/(?>a\Kbz|ab)/ |
|
ab |
|
0: ab |
|
|
|
/^(?&t)(?(DEFINE)(?<t>a\Kb))$/ |
|
ab |
|
0: b |
|
|
|
/^([^()]|\((?1)*\))*$/ |
|
a(b)c |
|
0: a(b)c |
|
1: c |
|
a(b(c)d)e |
|
0: a(b(c)d)e |
|
1: e |
|
|
|
/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/ |
|
0 |
|
0: 0 |
|
1: 0 |
|
00 |
|
0: 00 |
|
1: 00 |
|
2: 0 |
|
0000 |
|
0: 0000 |
|
1: 0000 |
|
2: 0 |
|
|
|
/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/ |
|
0 |
|
0: 0 |
|
1: 0 |
|
2: 0 |
|
00 |
|
0: 0 |
|
1: 0 |
|
2: 0 |
|
0000 |
|
0: 0 |
|
1: 0 |
|
2: 0 |
|
|
|
/--- This one does fail, as expected, in Perl. It needs the complex item at the |
|
end of the pattern. A single letter instead of (B|D) makes it not fail, |
|
which I think is a Perl bug. --- / |
|
|
|
/A(*COMMIT)(B|D)/ |
|
ACABX |
|
No match |
|
|
|
/--- Check the use of names for failure ---/ |
|
|
|
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K |
|
** Failers |
|
No match |
|
AC |
|
No match, mark = A |
|
CB |
|
No match, mark = B |
|
|
|
/--- Force no study, otherwise mark is not seen. The studied version is in |
|
test 2 because it isn't Perl-compatible. ---/ |
|
|
|
/(*MARK:A)(*SKIP:B)(C|X)/KSS |
|
C |
|
0: C |
|
1: C |
|
MK: A |
|
D |
|
No match, mark = A |
|
|
|
/^(A(*THEN:A)B|C(*THEN:B)D)/K |
|
** Failers |
|
No match |
|
CB |
|
No match, mark = B |
|
|
|
/^(?:A(*THEN:A)B|C(*THEN:B)D)/K |
|
CB |
|
No match, mark = B |
|
|
|
/^(?>A(*THEN:A)B|C(*THEN:B)D)/K |
|
CB |
|
No match, mark = B |
|
|
|
/--- This should succeed, as the skip causes bump to offset 1 (the mark). Note |
|
that we have to have something complicated such as (B|Z) at the end because, |
|
for Perl, a simple character somehow causes an unwanted optimization to mess |
|
with the handling of backtracking verbs. ---/ |
|
|
|
/A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK |
|
AAAC |
|
0: AC |
|
|
|
/--- Test skipping over a non-matching mark. ---/ |
|
|
|
/A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK |
|
AAAC |
|
0: AC |
|
|
|
/--- Check shorthand for MARK ---/ |
|
|
|
/A(*:A)A+(*SKIP:A)(B|Z) | AC/xK |
|
AAAC |
|
0: AC |
|
|
|
/--- Don't loop! Force no study, otherwise mark is not seen. ---/ |
|
|
|
/(*:A)A+(*SKIP:A)(B|Z)/KSS |
|
AAAC |
|
No match, mark = A |
|
|
|
/--- This should succeed, as a non-existent skip name disables the skip ---/ |
|
|
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK |
|
AAAC |
|
0: AC |
|
|
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK |
|
AAAC |
|
0: AC |
|
MK: B |
|
|
|
/--- COMMIT at the start of a pattern should act like an anchor. Again, |
|
however, we need the complication for Perl. ---/ |
|
|
|
/(*COMMIT)(A|P)(B|P)(C|P)/ |
|
ABCDEFG |
|
0: ABC |
|
1: A |
|
2: B |
|
3: C |
|
** Failers |
|
No match |
|
DEFGABC |
|
No match |
|
|
|
/--- COMMIT inside an atomic group can't stop backtracking over the group. ---/ |
|
|
|
/(\w+)(?>b(*COMMIT))\w{2}/ |
|
abbb |
|
0: abbb |
|
1: a |
|
|
|
/(\w+)b(*COMMIT)\w{2}/ |
|
abbb |
|
No match |
|
|
|
/--- Check opening parens in comment when seeking forward reference. ---/ |
|
|
|
/(?&t)(?#()(?(DEFINE)(?<t>a))/ |
|
bac |
|
0: a |
|
|
|
/--- COMMIT should override THEN ---/ |
|
|
|
/(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/ |
|
yes |
|
No match |
|
|
|
/(?>(*COMMIT)(yes|no)(*THEN)(*F))?/ |
|
yes |
|
No match |
|
|
|
/b?(*SKIP)c/ |
|
bc |
|
0: bc |
|
abc |
|
0: bc |
|
|
|
/(*SKIP)bc/ |
|
a |
|
No match |
|
|
|
/(*SKIP)b/ |
|
a |
|
No match |
|
|
|
/(?P<abn>(?P=abn)xxx|)+/ |
|
xxx |
|
0: |
|
1: |
|
|
|
/(?i:([^b]))(?1)/ |
|
aa |
|
0: aa |
|
1: a |
|
aA |
|
0: aA |
|
1: a |
|
** Failers |
|
0: ** |
|
1: * |
|
ab |
|
No match |
|
aB |
|
No match |
|
Ba |
|
No match |
|
ba |
|
No match |
|
|
|
/^(?&t)*+(?(DEFINE)(?<t>a))\w$/ |
|
aaaaaaX |
|
0: aaaaaaX |
|
** Failers |
|
No match |
|
aaaaaa |
|
No match |
|
|
|
/^(?&t)*(?(DEFINE)(?<t>a))\w$/ |
|
aaaaaaX |
|
0: aaaaaaX |
|
aaaaaa |
|
0: aaaaaa |
|
|
|
/^(a)*+(\w)/ |
|
aaaaX |
|
0: aaaaX |
|
1: a |
|
2: X |
|
YZ |
|
0: Y |
|
1: <unset> |
|
2: Y |
|
** Failers |
|
No match |
|
aaaa |
|
No match |
|
|
|
/^(?:a)*+(\w)/ |
|
aaaaX |
|
0: aaaaX |
|
1: X |
|
YZ |
|
0: Y |
|
1: Y |
|
** Failers |
|
No match |
|
aaaa |
|
No match |
|
|
|
/^(a)++(\w)/ |
|
aaaaX |
|
0: aaaaX |
|
1: a |
|
2: X |
|
** Failers |
|
No match |
|
aaaa |
|
No match |
|
YZ |
|
No match |
|
|
|
/^(?:a)++(\w)/ |
|
aaaaX |
|
0: aaaaX |
|
1: X |
|
** Failers |
|
No match |
|
aaaa |
|
No match |
|
YZ |
|
No match |
|
|
|
/^(a)?+(\w)/ |
|
aaaaX |
|
0: aa |
|
1: a |
|
2: a |
|
YZ |
|
0: Y |
|
1: <unset> |
|
2: Y |
|
|
|
/^(?:a)?+(\w)/ |
|
aaaaX |
|
0: aa |
|
1: a |
|
YZ |
|
0: Y |
|
1: Y |
|
|
|
/^(a){2,}+(\w)/ |
|
aaaaX |
|
0: aaaaX |
|
1: a |
|
2: X |
|
** Failers |
|
No match |
|
aaa |
|
No match |
|
YZ |
|
No match |
|
|
|
/^(?:a){2,}+(\w)/ |
|
aaaaX |
|
0: aaaaX |
|
1: X |
|
** Failers |
|
No match |
|
aaa |
|
No match |
|
YZ |
|
No match |
|
|
|
/(a|)*(?1)b/ |
|
b |
|
0: b |
|
1: |
|
ab |
|
0: ab |
|
1: |
|
aab |
|
0: aab |
|
1: |
|
|
|
/(a)++(?1)b/ |
|
** Failers |
|
No match |
|
ab |
|
No match |
|
aab |
|
No match |
|
|
|
/(a)*+(?1)b/ |
|
** Failers |
|
No match |
|
ab |
|
No match |
|
aab |
|
No match |
|
|
|
/(?1)(?:(b)){0}/ |
|
b |
|
0: b |
|
|
|
/(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x |
|
foo(bar(baz)+baz(bop)) |
|
0: foo(bar(baz)+baz(bop)) |
|
1: foo(bar(baz)+baz(bop)) |
|
2: (bar(baz)+baz(bop)) |
|
3: bar(baz)+baz(bop) |
|
|
|
/(A (A|B(*ACCEPT)|C) D)(E)/x |
|
AB |
|
0: AB |
|
1: AB |
|
2: B |
|
|
|
/\A.*?(a|bc)/ |
|
ba |
|
0: ba |
|
1: a |
|
|
|
/\A.*?(?:a|bc)++/ |
|
ba |
|
0: ba |
|
|
|
/\A.*?(a|bc)++/ |
|
ba |
|
0: ba |
|
1: a |
|
|
|
/\A.*?(?:a|bc|d)/ |
|
ba |
|
0: ba |
|
|
|
/(?:(b))++/ |
|
beetle |
|
0: b |
|
1: b |
|
|
|
/(?(?=(a(*ACCEPT)z))a)/ |
|
a |
|
0: a |
|
1: a |
|
|
|
/^(a)(?1)+ab/ |
|
aaaab |
|
0: aaaab |
|
1: a |
|
|
|
/^(a)(?1)++ab/ |
|
aaaab |
|
No match |
|
|
|
/^(?=a(*:M))aZ/K |
|
aZbc |
|
0: aZ |
|
MK: M |
|
|
|
/^(?!(*:M)b)aZ/K |
|
aZbc |
|
0: aZ |
|
|
|
/(?(DEFINE)(a))?b(?1)/ |
|
backgammon |
|
0: ba |
|
|
|
/^\N+/ |
|
abc\ndef |
|
0: abc |
|
|
|
/^\N{1,}/ |
|
abc\ndef |
|
0: abc |
|
|
|
/(?(R)a+|(?R)b)/ |
|
aaaabcde |
|
0: aaaab |
|
|
|
/(?(R)a+|((?R))b)/ |
|
aaaabcde |
|
0: aaaab |
|
1: aaaa |
|
|
|
/((?(R)a+|(?1)b))/ |
|
aaaabcde |
|
0: aaaab |
|
1: aaaab |
|
|
|
/((?(R1)a+|(?1)b))/ |
|
aaaabcde |
|
0: aaaab |
|
1: aaaab |
|
|
|
/a(*:any |
|
name)/K |
|
abc |
|
0: a |
|
MK: any \x0aname |
|
|
|
/(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/ |
|
a |
|
0: a |
|
ba |
|
0: a |
|
bba |
|
0: a |
|
|
|
/--- Checking revised (*THEN) handling ---/ |
|
|
|
/--- Capture ---/ |
|
|
|
/^.*? (a(*THEN)b) c/x |
|
aabc |
|
No match |
|
|
|
/^.*? (a(*THEN)b|(*F)) c/x |
|
aabc |
|
0: aabc |
|
1: ab |
|
|
|
/^.*? ( (a(*THEN)b) | (*F) ) c/x |
|
aabc |
|
0: aabc |
|
1: ab |
|
2: ab |
|
|
|
/^.*? ( (a(*THEN)b) ) c/x |
|
aabc |
|
No match |
|
|
|
/--- Non-capture ---/ |
|
|
|
/^.*? (?:a(*THEN)b) c/x |
|
aabc |
|
No match |
|
|
|
/^.*? (?:a(*THEN)b|(*F)) c/x |
|
aabc |
|
0: aabc |
|
|
|
/^.*? (?: (?:a(*THEN)b) | (*F) ) c/x |
|
aabc |
|
0: aabc |
|
|
|
/^.*? (?: (?:a(*THEN)b) ) c/x |
|
aabc |
|
No match |
|
|
|
/--- Atomic ---/ |
|
|
|
/^.*? (?>a(*THEN)b) c/x |
|
aabc |
|
No match |
|
|
|
/^.*? (?>a(*THEN)b|(*F)) c/x |
|
aabc |
|
0: aabc |
|
|
|
/^.*? (?> (?>a(*THEN)b) | (*F) ) c/x |
|
aabc |
|
0: aabc |
|
|
|
/^.*? (?> (?>a(*THEN)b) ) c/x |
|
aabc |
|
No match |
|
|
|
/--- Possessive capture ---/ |
|
|
|
/^.*? (a(*THEN)b)++ c/x |
|
aabc |
|
No match |
|
|
|
/^.*? (a(*THEN)b|(*F))++ c/x |
|
aabc |
|
0: aabc |
|
1: ab |
|
|
|
/^.*? ( (a(*THEN)b)++ | (*F) )++ c/x |
|
aabc |
|
0: aabc |
|
1: ab |
|
2: ab |
|
|
|
/^.*? ( (a(*THEN)b)++ )++ c/x |
|
aabc |
|
No match |
|
|
|
/--- Possessive non-capture ---/ |
|
|
|
/^.*? (?:a(*THEN)b)++ c/x |
|
aabc |
|
No match |
|
|
|
/^.*? (?:a(*THEN)b|(*F))++ c/x |
|
aabc |
|
0: aabc |
|
|
|
/^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x |
|
aabc |
|
0: aabc |
|
|
|
/^.*? (?: (?:a(*THEN)b)++ )++ c/x |
|
aabc |
|
No match |
|
|
|
/--- Condition assertion ---/ |
|
|
|
/^(?(?=a(*THEN)b)ab|ac)/ |
|
ac |
|
0: ac |
|
|
|
/--- Condition ---/ |
|
|
|
/^.*?(?(?=a)a|b(*THEN)c)/ |
|
ba |
|
No match |
|
|
|
/^.*?(?:(?(?=a)a|b(*THEN)c)|d)/ |
|
ba |
|
0: ba |
|
|
|
/^.*?(?(?=a)a(*THEN)b|c)/ |
|
ac |
|
No match |
|
|
|
/--- Assertion ---/ |
|
|
|
/^.*(?=a(*THEN)b)/ |
|
aabc |
|
0: a |
|
|
|
/------------------------------/ |
|
|
|
/(?>a(*:m))/imsxSK |
|
a |
|
0: a |
|
MK: m |
|
|
|
/(?>(a)(*:m))/imsxSK |
|
a |
|
0: a |
|
1: a |
|
MK: m |
|
|
|
/(?<=a(*ACCEPT)b)c/ |
|
xacd |
|
0: c |
|
|
|
/(?<=(a(*ACCEPT)b))c/ |
|
xacd |
|
0: c |
|
1: a |
|
|
|
/(?<=(a(*COMMIT)b))c/ |
|
xabcd |
|
0: c |
|
1: ab |
|
** Failers |
|
No match |
|
xacd |
|
No match |
|
|
|
/(?<!a(*FAIL)b)c/ |
|
xcd |
|
0: c |
|
acd |
|
0: c |
|
|
|
/(?<=a(*:N)b)c/K |
|
xabcd |
|
0: c |
|
MK: N |
|
|
|
/(?<=a(*PRUNE)b)c/ |
|
xabcd |
|
0: c |
|
|
|
/(?<=a(*SKIP)b)c/ |
|
xabcd |
|
0: c |
|
|
|
/(?<=a(*THEN)b)c/ |
|
xabcd |
|
0: c |
|
|
|
/(a)(?2){2}(.)/ |
|
abcd |
|
0: abcd |
|
1: a |
|
2: d |
|
|
|
/(*MARK:A)(*PRUNE:B)(C|X)/KS |
|
C |
|
0: C |
|
1: C |
|
MK: B |
|
D |
|
No match, mark = B |
|
|
|
/(*MARK:A)(*PRUNE:B)(C|X)/KSS |
|
C |
|
0: C |
|
1: C |
|
MK: B |
|
D |
|
No match, mark = B |
|
|
|
/(*MARK:A)(*THEN:B)(C|X)/KS |
|
C |
|
0: C |
|
1: C |
|
MK: B |
|
D |
|
No match, mark = B |
|
|
|
/(*MARK:A)(*THEN:B)(C|X)/KSY |
|
C |
|
0: C |
|
1: C |
|
MK: B |
|
D |
|
No match, mark = B |
|
|
|
/(*MARK:A)(*THEN:B)(C|X)/KSS |
|
C |
|
0: C |
|
1: C |
|
MK: B |
|
D |
|
No match, mark = B |
|
|
|
/--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/ |
|
|
|
/A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK |
|
AAAC |
|
No match, mark = A |
|
|
|
/--- Same --/ |
|
|
|
/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK |
|
AAAC |
|
No match, mark = B |
|
|
|
/A(*:A)A+(*SKIP)(B|Z) | AC/xK |
|
AAAC |
|
No match, mark = A |
|
|
|
/--- This should fail, as a null name is the same as no name ---/ |
|
|
|
/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK |
|
AAAC |
|
No match, mark = A |
|
|
|
/--- 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 |
|
0: AB |
|
MK: A |
|
XXYZ |
|
0: XXY |
|
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 |
|
|
|
/^(A(*THEN:A)B|C(*THEN:B)D)/K |
|
AB |
|
0: AB |
|
1: AB |
|
MK: A |
|
CD |
|
0: CD |
|
1: CD |
|
MK: B |
|
** Failers |
|
No match |
|
AC |
|
No match, mark = A |
|
CB |
|
No match, mark = B |
|
|
|
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K |
|
AB |
|
0: AB |
|
1: AB |
|
MK: A |
|
CD |
|
0: CD |
|
1: CD |
|
MK: B |
|
** Failers |
|
No match |
|
AC |
|
No match, mark = A |
|
CB |
|
No match, mark = B |
|
|
|
/--- 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 |
|
0: AB |
|
1: AB |
|
CD |
|
0: CD |
|
1: CD |
|
MK: B |
|
|
|
/--- PRUNE goes to next bumpalong; COMMIT does not. ---/ |
|
|
|
/A(*PRUNE:A)B/K |
|
ACAB |
|
0: AB |
|
MK: A |
|
|
|
/--- Mark names can be duplicated ---/ |
|
|
|
/A(*:A)B|X(*:A)Y/K |
|
AABC |
|
0: AB |
|
MK: A |
|
XXYZ |
|
0: XY |
|
MK: A |
|
|
|
/b(*:m)f|a(*:n)w/K |
|
aw |
|
0: aw |
|
MK: n |
|
** Failers |
|
No match, mark = n |
|
abc |
|
No match, mark = m |
|
|
|
/b(*:m)f|aw/K |
|
abaw |
|
0: aw |
|
** Failers |
|
No match |
|
abc |
|
No match, mark = m |
|
abax |
|
No match, mark = m |
|
|
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK |
|
AAAC |
|
0: AAC |
|
|
|
/a(*PRUNE:X)bc|qq/KY |
|
** Failers |
|
No match, mark = X |
|
axy |
|
No match, mark = X |
|
|
|
/a(*THEN:X)bc|qq/KY |
|
** Failers |
|
No match, mark = X |
|
axy |
|
No match, mark = X |
|
|
|
/(?=a(*MARK:A)b)..x/K |
|
abxy |
|
0: abx |
|
MK: A |
|
** Failers |
|
No match |
|
abpq |
|
No match |
|
|
|
/(?=a(*MARK:A)b)..(*:Y)x/K |
|
abxy |
|
0: abx |
|
MK: Y |
|
** Failers |
|
No match |
|
abpq |
|
No match |
|
|
|
/(?=a(*PRUNE:A)b)..x/K |
|
abxy |
|
0: abx |
|
MK: A |
|
** Failers |
|
No match |
|
abpq |
|
No match |
|
|
|
/(?=a(*PRUNE:A)b)..(*:Y)x/K |
|
abxy |
|
0: abx |
|
MK: Y |
|
** Failers |
|
No match |
|
abpq |
|
No match |
|
|
|
/(?=a(*THEN:A)b)..x/K |
|
abxy |
|
0: abx |
|
MK: A |
|
** Failers |
|
No match |
|
abpq |
|
No match |
|
|
|
/(?=a(*THEN:A)b)..(*:Y)x/K |
|
abxy |
|
0: abx |
|
MK: Y |
|
** Failers |
|
No match |
|
abpq |
|
No match |
|
|
|
/(another)?(\1?)test/ |
|
hello world test |
|
0: test |
|
1: <unset> |
|
2: |
|
|
|
/(another)?(\1+)test/ |
|
hello world test |
|
No match |
|
|
|
/(a(*COMMIT)b){0}a(?1)|aac/ |
|
aac |
|
0: aac |
|
|
|
/((?:a?)*)*c/ |
|
aac |
|
0: aac |
|
1: |
|
|
|
/((?>a?)*)*c/ |
|
aac |
|
0: aac |
|
1: |
|
|
|
/(?>.*?a)(?<=ba)/ |
|
aba |
|
0: ba |
|
|
|
/(?:.*?a)(?<=ba)/ |
|
aba |
|
0: aba |
|
|
|
/.*?a(*PRUNE)b/ |
|
aab |
|
0: ab |
|
|
|
/.*?a(*PRUNE)b/s |
|
aab |
|
0: ab |
|
|
|
/^a(*PRUNE)b/s |
|
aab |
|
No match |
|
|
|
/.*?a(*SKIP)b/ |
|
aab |
|
0: ab |
|
|
|
/(?>.*?a)b/s |
|
aab |
|
0: ab |
|
|
|
/(?>.*?a)b/ |
|
aab |
|
0: ab |
|
|
|
/(?>^a)b/s |
|
aab |
|
No match |
|
|
|
/(?>.*?)(?<=(abcd)|(wxyz))/ |
|
alphabetabcd |
|
0: |
|
1: abcd |
|
endingwxyz |
|
0: |
|
1: <unset> |
|
2: wxyz |
|
|
|
/(?>.*)(?<=(abcd)|(wxyz))/ |
|
alphabetabcd |
|
0: alphabetabcd |
|
1: abcd |
|
endingwxyz |
|
0: endingwxyz |
|
1: <unset> |
|
2: wxyz |
|
|
|
"(?>.*)foo" |
|
abcdfooxyz |
|
No match |
|
|
|
"(?>.*?)foo" |
|
abcdfooxyz |
|
0: foo |
|
|
|
/(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/ |
|
ac |
|
0: ac |
|
|
|
/(?:(a(*SKIP)b)){0}(?:(?1)|ac)/ |
|
ac |
|
0: ac |
|
|
|
/(?<=(*SKIP)ac)a/ |
|
aa |
|
No match |
|
|
|
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK |
|
AAAC |
|
0: AC |
|
|
|
/a(*SKIP:m)x|ac(*:n)(*SKIP:n)d|ac/K |
|
acacd |
|
0: acd |
|
MK: n |
|
|
|
/A(*SKIP:m)x|A(*SKIP:n)x|AB/K |
|
AB |
|
0: AB |
|
|
|
/((*SKIP:r)d){0}a(*SKIP:m)x|ac(*:n)|ac/K |
|
acacd |
|
0: ac |
|
MK: n |
|
|
|
/-- Tests that try to figure out how Perl works. My hypothesis is that the |
|
first verb that is backtracked onto is the one that acts. This seems to be |
|
the case almost all the time, but there is one exception that is perhaps a |
|
bug. --/ |
|
|
|
/-- This matches "aaaac"; each PRUNE advances one character until the subject |
|
no longer starts with 5 'a's. --/ |
|
|
|
/aaaaa(*PRUNE)b|a+c/ |
|
aaaaaac |
|
0: aaaac |
|
|
|
/-- Putting SKIP in front of PRUNE makes no difference, as it is never |
|
backtracked onto, whether or not it has a label. --/ |
|
|
|
/aaaaa(*SKIP)(*PRUNE)b|a+c/ |
|
aaaaaac |
|
0: aaaac |
|
|
|
/aaaaa(*SKIP:N)(*PRUNE)b|a+c/ |
|
aaaaaac |
|
0: aaaac |
|
|
|
/aaaa(*:N)a(*SKIP:N)(*PRUNE)b|a+c/ |
|
aaaaaac |
|
0: aaaac |
|
|
|
/-- Putting THEN in front makes no difference. */ |
|
|
|
/aaaaa(*THEN)(*PRUNE)b|a+c/ |
|
aaaaaac |
|
0: aaaac |
|
|
|
/-- However, putting COMMIT in front of the prune changes it to "no match". I |
|
think this is inconsistent and possibly a bug. For the moment, running this |
|
test is moved out of the Perl-compatible file. --/ |
|
|
|
/aaaaa(*COMMIT)(*PRUNE)b|a+c/ |
|
|
|
|
|
/---- OK, lets play the same game again using SKIP instead of PRUNE. ----/ |
|
|
|
/-- This matches "ac" because SKIP forces the next match to start on the |
|
sixth "a". --/ |
|
|
|
/aaaaa(*SKIP)b|a+c/ |
|
aaaaaac |
|
0: ac |
|
|
|
/-- Putting PRUNE in front makes no difference. --/ |
|
|
|
/aaaaa(*PRUNE)(*SKIP)b|a+c/ |
|
aaaaaac |
|
0: ac |
|
|
|
/-- Putting THEN in front makes no difference. --/ |
|
|
|
/aaaaa(*THEN)(*SKIP)b|a+c/ |
|
aaaaaac |
|
0: ac |
|
|
|
/-- In this case, neither does COMMIT. This still matches "ac". --/ |
|
|
|
/aaaaa(*COMMIT)(*SKIP)b|a+c/ |
|
aaaaaac |
|
0: ac |
|
|
|
/-- This gives "no match", as expected. --/ |
|
|
|
/aaaaa(*COMMIT)b|a+c/ |
|
aaaaaac |
|
No match |
|
|
|
|
|
/------ Tests using THEN ------/ |
|
|
|
/-- This matches "aaaaaac", as expected. --/ |
|
|
|
/aaaaa(*THEN)b|a+c/ |
|
aaaaaac |
|
0: aaaaaac |
|
|
|
/-- Putting SKIP in front makes no difference. --/ |
|
|
|
/aaaaa(*SKIP)(*THEN)b|a+c/ |
|
aaaaaac |
|
0: aaaaaac |
|
|
|
/-- Putting PRUNE in front makes no difference. --/ |
|
|
|
/aaaaa(*PRUNE)(*THEN)b|a+c/ |
|
aaaaaac |
|
0: aaaaaac |
|
|
|
/-- Putting COMMIT in front makes no difference. --/ |
|
|
|
/aaaaa(*COMMIT)(*THEN)b|a+c/ |
|
aaaaaac |
|
0: aaaaaac |
|
|
|
/-- End of "priority" tests --/ |
|
|
|
/aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/ |
|
aaaaaa |
|
0: a |
|
|
|
/aaaaa(*:m)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/ |
|
aaaaaa |
|
0: a |
|
|
|
/aaaaa(*:n)(*PRUNE:m)(*SKIP:m)m|a+/ |
|
aaaaaa |
|
0: aaaa |
|
|
|
/aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/ |
|
aaaaaa |
|
0: a |
|
|
|
/a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/ |
|
aaaac |
|
0: aac |
|
|
|
/a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/ |
|
aaaac |
|
0: ac |
|
|
|
/aaa(*PRUNE:A)a(*SKIP:A)b|a+c/ |
|
aaaac |
|
0: aac |
|
|
|
/aaa(*MARK:A)a(*SKIP:A)b|a+c/ |
|
aaaac |
|
0: ac |
|
|
|
/a(*:m)a(*COMMIT)(*SKIP:m)b|a+c/K |
|
aaaaaac |
|
0: ac |
|
|
|
/.?(a|b(*THEN)c)/ |
|
ba |
|
0: ba |
|
1: a |
|
|
|
/(a(*COMMIT)b)c|abd/ |
|
abc |
|
0: abc |
|
1: ab |
|
abd |
|
No match |
|
|
|
/(?=a(*COMMIT)b)abc|abd/ |
|
abc |
|
0: abc |
|
abd |
|
0: abd |
|
|
|
/(?>a(*COMMIT)b)c|abd/ |
|
abc |
|
0: abc |
|
abd |
|
0: abd |
|
|
|
/a(?=b(*COMMIT)c)[^d]|abd/ |
|
abd |
|
No match |
|
abc |
|
0: ab |
|
|
|
/a(?=bc).|abd/ |
|
abd |
|
0: abd |
|
abc |
|
0: ab |
|
|
|
/a(?>b(*COMMIT)c)d|abd/ |
|
abceabd |
|
No match |
|
|
|
/a(?>bc)d|abd/ |
|
abceabd |
|
0: abd |
|
|
|
/(?>a(*COMMIT)b)c|abd/ |
|
abd |
|
0: abd |
|
|
|
/(?>a(*COMMIT)c)d|abd/ |
|
abd |
|
No match |
|
|
|
/((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/ |
|
ac |
|
0: ac |
|
1: <unset> |
|
2: c |
|
|
|
/-- These tests were formerly in test 2, but changes in PCRE and Perl have |
|
made them compatible. --/ |
|
|
|
/^(a)?(?(1)a|b)+$/ |
|
*** Failers |
|
No match |
|
a |
|
No match |
|
|
|
/(?=a\Kb)ab/ |
|
ab |
|
0: b |
|
|
|
/(?!a\Kb)ac/ |
|
ac |
|
0: ac |
|
|
|
/^abc(?<=b\Kc)d/ |
|
abcd |
|
0: cd |
|
|
|
/^abc(?<!b\Kq)d/ |
|
abcd |
|
0: abcd |
|
|
|
|
|
/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK |
|
AAAC |
|
No match, mark = A |
|
|
|
/^((abc|abcx)(*THEN)y|abcd)/ |
|
abcd |
|
0: abcd |
|
1: abcd |
|
*** Failers |
|
No match |
|
abcxy |
|
No match |
|
|
|
/^((yes|no)(*THEN)(*F))?/ |
|
yes |
|
No match |
|
|
|
/(A (.*) C? (*THEN) | A D) (*FAIL)/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) C? (*THEN) | A D) z/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) C? (*THEN) | A D) \s* (*FAIL)/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) C? (*THEN) | A D) \s* z/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) (?:C|) (*THEN) | A D) (*FAIL)/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) (?:C|) (*THEN) | A D) z/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) C{0,6} (*THEN) | A D) (*FAIL)/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) C{0,6} (*THEN) | A D) z/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) (CE){0,6} (*THEN) | A D) (*FAIL)/x |
|
AbcdCEBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) (CE){0,6} (*THEN) | A D) z/x |
|
AbcdCEBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) (CE*){0,6} (*THEN) | A D) (*FAIL)/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(A (.*) (CE*){0,6} (*THEN) | A D) z/x |
|
AbcdCBefgBhiBqz |
|
No match |
|
|
|
/(?=a(*COMMIT)b|ac)ac|ac/ |
|
ac |
|
No match |
|
|
|
/(?=a(*COMMIT)b|(ac)) ac | (a)c/x |
|
ac |
|
No match |
|
|
|
/--------/ |
|
|
|
/(?(?!b(*THEN)a)bn|bnn)/ |
|
bnn |
|
0: bn |
|
|
|
/(?!b(*SKIP)a)bn|bnn/ |
|
bnn |
|
0: bn |
|
|
|
/(?(?!b(*SKIP)a)bn|bnn)/ |
|
bnn |
|
0: bn |
|
|
|
/(?!b(*PRUNE)a)bn|bnn/ |
|
bnn |
|
0: bn |
|
|
|
/(?(?!b(*PRUNE)a)bn|bnn)/ |
|
bnn |
|
0: bn |
|
|
|
/(?!b(*COMMIT)a)bn|bnn/ |
|
bnn |
|
0: bn |
|
|
|
/(?(?!b(*COMMIT)a)bn|bnn)/ |
|
bnn |
|
0: bn |
|
|
|
/(?=b(*SKIP)a)bn|bnn/ |
|
bnn |
|
No match |
|
|
|
/(?=b(*THEN)a)bn|bnn/ |
|
bnn |
|
0: bnn |
|
|
|
/^(?!a(*SKIP)b)/ |
|
ac |
|
0: |
|
|
|
/^(?!a(*SKIP)b)../ |
|
acd |
|
0: ac |
|
|
|
/(?!a(*SKIP)b)../ |
|
acd |
|
0: ac |
|
|
|
/^(?(?!a(*SKIP)b))/ |
|
ac |
|
0: |
|
|
|
/^(?!a(*PRUNE)b)../ |
|
acd |
|
0: ac |
|
|
|
/(?!a(*PRUNE)b)../ |
|
acd |
|
0: ac |
|
|
|
/(?!a(*COMMIT)b)ac|cd/ |
|
ac |
|
0: ac |
|
|
|
/\A.*?(?:a|bc)/ |
|
ba |
|
0: ba |
|
|
|
/^(A(*THEN)B|C(*THEN)D)/ |
|
CD |
|
0: CD |
|
1: CD |
|
|
|
/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K |
|
abc |
|
0: b |
|
MK: m(m |
|
|
|
/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K |
|
abc |
|
0: b |
|
MK: m(m |
|
|
|
/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K |
|
abc |
|
0: b |
|
|
|
/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K |
|
abc |
|
0: b |
|
MK: m(m |
|
|
|
/^\d*\w{4}/ |
|
1234 |
|
0: 1234 |
|
123 |
|
No match |
|
|
|
/^[^b]*\w{4}/ |
|
aaaa |
|
0: aaaa |
|
aaa |
|
No match |
|
|
|
/^[^b]*\w{4}/i |
|
aaaa |
|
0: aaaa |
|
aaa |
|
No match |
|
|
|
/^a*\w{4}/ |
|
aaaa |
|
0: aaaa |
|
aaa |
|
No match |
|
|
|
/^a*\w{4}/i |
|
aaaa |
|
0: aaaa |
|
aaa |
|
No match |
|
|
|
/(?(?=ab)ab)/+ |
|
ca |
|
0: |
|
0+ ca |
|
cd |
|
0: |
|
0+ cd |
|
|
|
/(?:(?<n>foo)|(?<n>bar))\k<n>/J |
|
foofoo |
|
0: foofoo |
|
1: foo |
|
barbar |
|
0: barbar |
|
1: <unset> |
|
2: bar |
|
|
|
/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/J |
|
AfooA |
|
0: AfooA |
|
1: A |
|
2: foo |
|
AbarA |
|
0: AbarA |
|
1: A |
|
2: <unset> |
|
3: bar |
|
** Failers |
|
No match |
|
Afoofoo |
|
No match |
|
Abarbar |
|
No match |
|
|
|
/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ |
|
1 IN SOA non-sp1 non-sp2( |
|
0: 1 IN SOA non-sp1 non-sp2( |
|
1: 1 |
|
2: non-sp1 |
|
3: non-sp2 |
|
|
|
/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/xJ |
|
Ax |
|
0: Ax |
|
1: A |
|
BAxy |
|
0: BAxy |
|
1: <unset> |
|
2: B |
|
3: A |
|
|
|
/^A\xZ/ |
|
A\0Z |
|
0: A\x00Z |
|
|
|
/^A\o{123}B/ |
|
A\123B |
|
0: ASB |
|
|
|
/ ^ a + + b $ /x |
|
aaaab |
|
0: aaaab |
|
|
|
/ ^ a + #comment |
|
+ b $ /x |
|
aaaab |
|
0: aaaab |
|
|
|
/ ^ a + #comment |
|
#comment |
|
+ b $ /x |
|
aaaab |
|
0: aaaab |
|
|
|
/ ^ (?> a + ) b $ /x |
|
aaaab |
|
0: aaaab |
|
|
|
/ ^ ( a + ) + + \w $ /x |
|
aaaab |
|
0: aaaab |
|
1: aaaa |
|
|
|
/(?:a\Kb)*+/+ |
|
ababc |
|
0: b |
|
0+ c |
|
|
|
/(?>a\Kb)*/+ |
|
ababc |
|
0: b |
|
0+ c |
|
|
|
/(?:a\Kb)*/+ |
|
ababc |
|
0: b |
|
0+ c |
|
|
|
/(a\Kb)*+/+ |
|
ababc |
|
0: b |
|
0+ c |
|
1: ab |
|
|
|
/(a\Kb)*/+ |
|
ababc |
|
0: b |
|
0+ c |
|
1: ab |
|
|
/-- End of testinput1 --/ |
/-- End of testinput1 --/ |