1 /-- These tests are for the Perl 5.10 features that PCRE supports. --/
10 \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
11 \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
12 \x09\x20\xa0\x0a\x0b\x0c
30 /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
31 >XY\x0aZ\x0aA\x0bNN\x0c
32 >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
58 /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
81 /^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
84 /^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
87 /^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
90 /(?'abc'\w+):\k<abc>{2}/
97 /(?'abc'\w+):\g{abc}{2}/
104 /^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
114 /^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
117 /(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
124 /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
132 /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
141 now is the time for all good men to come to the aid of the party
143 this is not a line with only words and spaces!
159 /([^()]++|\([^()]*\))+/
162 /\(([^()]++|\([^()]+\))+\)/
166 ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
168 /^([^()]|\((?1)*\))*$/
175 /^>abc>([^()]|\((?1)*\))*<xyz<$/
180 /^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
182 Satanoscillatemymetallicsonatas
183 AmanaplanacanalPanama
188 /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
202 /((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
218 /a+b?(*PRUNE)c+(*FAIL)/
221 /a+b?(*COMMIT)c+(*FAIL)/
224 /a+b?(*SKIP)c+(*FAIL)/
227 /^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
236 /^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
245 /a+b?(*THEN)c+(*FAIL)/
248 /(A (A|B(*ACCEPT)|C) D)(E)/x
255 /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i
257 Satan, oscillate my metallic sonatas!
258 A man, a plan, a canal: Panama!
259 Able was I ere I saw Elba.
293 /^(?|(abc)|(def))(?1)/
300 /(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ
306 /(?:(?1)|B)(A(*F)|C)/
312 /^(?:(?1)|B)(A(*F)|C)/
320 /(?:(?1)|B)(A(*ACCEPT)XX|C)D/
330 /(?(DEFINE)(A))B(?1)C/
333 /(?(DEFINE)((A)\2))B(?1)C/
336 /(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x
375 /^(?&t)(?(DEFINE)(?<t>a\Kb))$/
378 /^([^()]|\((?1)*\))*$/
382 /(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
387 /(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
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. --- /
399 /--- Check the use of names for failure ---/
401 /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
406 /(*MARK:A)(*SKIP:B)(C|X)/K
410 /^(A(*THEN:A)B|C(*THEN:B)D)/K
414 /^(?:A(*THEN:A)B|C(*THEN:B)D)/K
417 /^(?>A(*THEN:A)B|C(*THEN:B)D)/K
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. ---/
425 /A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK
428 /--- Test skipping over a non-matching mark. ---/
430 /A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK
433 /--- Check shorthand for MARK ---/
435 /A(*:A)A+(*SKIP:A)(B|Z) | AC/xK
438 /--- Don't loop! ---/
440 /(*:A)A+(*SKIP:A)(B|Z)/K
443 /--- This should succeed, as a non-existent skip name disables the skip ---/
445 /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
448 /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK
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
456 /(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/xK
465 /--- COMMIT at the start of a pattern should act like an anchor. Again,
466 however, we need the complication for Perl. ---/
468 /(*COMMIT)(A|P)(B|P)(C|P)/
473 /--- COMMIT inside an atomic group can't stop backtracking over the group. ---/
475 /(\w+)(?>b(*COMMIT))\w{2}/
478 /(\w+)b(*COMMIT)\w{2}/
481 /--- Check opening parens in comment when seeking forward reference. ---/
483 /(?&t)(?#()(?(DEFINE)(?<t>a))/
486 /-- End of testinput11 --/