# This set of tests is not Perl-compatible. It checks on special features # of PCRE2's API, error diagnostics, and the compiled code of some patterns. # It also checks the non-Perl syntax that PCRE2 supports (Python, .NET, # Oniguruma). There are also some tests where PCRE2 and Perl differ, # either because PCRE2 can't be compatible, or there is a possible Perl # bug. # NOTE: This is a non-UTF set of tests. When UTF support is needed, use # test 5. #forbid_utf # Test binary zeroes in the pattern # /a\0B/ where 0 is a binary zero /61 5c 00 62/B,hex a\x{0}b # /a0b/ where 0 is a binary zero /61 00 62/B,hex a\x{0}b # /(?#B0C)DE/ where 0 is a binary zero /28 3f 23 42 00 43 29 44 45/B,hex DE /(a)b|/I /abc/I abc defabc abc\=anchored *** Failers defabc\=anchored ABC /^abc/I abc abc\=anchored *** Failers defabc defabc\=anchored /a+bc/I /a*bc/I /a{3}bc/I /(abc|a+z)/I /^abc$/I abc *** Failers def\nabc /ab\idef/ /(?X)ab\idef/ /x{5,4}/ /z{65536}/ /[abcd/ /[\B]/B /[\R]/B /[\X]/B /[z-a]/ /^*/ /(abc/ /(?# abc/ /(?z)abc/ /.*b/I /.*?b/I /cat|dog|elephant/I this sentence eventually mentions a cat this sentences rambles on and on for a while and then reaches elephant /cat|dog|elephant/I this sentence eventually mentions a cat this sentences rambles on and on for a while and then reaches elephant /cat|dog|elephant/Ii this sentence eventually mentions a CAT cat this sentences rambles on and on for a while to elephant ElePhant /a|[bcd]/I /(a|[^\dZ])/I /(a|b)*[\s]/I /(ab\2)/ /{4,5}abc/ /(a)(b)(c)\2/I abcb abcb\=ovector=0 abcb\=ovector=1 abcb\=ovector=2 abcb\=ovector=3 abcb\=ovector=4 /(a)bc|(a)(b)\2/I abc abc\=ovector=0 abc\=ovector=1 abc\=ovector=2 aba aba\=ovector=0 aba\=ovector=1 aba\=ovector=2 aba\=ovector=3 aba\=ovector=4 /abc$/I,dollar_endonly abc *** Failers abc\n abc\ndef /(a)(b)(c)(d)(e)\6/ /the quick brown fox/I the quick brown fox this is a line with the quick brown fox /the quick brown fox/I,anchored the quick brown fox *** Failers this is a line with the quick brown fox /ab(?z)cd/ /^abc|def/I abcdef abcdef\=notbol /.*((abc)$|(def))/I defabc defabc\=noteol /)/ /a[]b/ /[^aeiou ]{3,}/I co-processors, and for /<.*>/I abcghinop /<.*?>/I abcghinop /<.*>/I,ungreedy abcghinop /(?U)<.*>/I abcghinop /<.*?>/I,ungreedy abcghinop /={3,}/I,ungreedy abc========def /(?U)={3,}?/I abc========def /(?^abc)/Im abc def\nabc *** Failers defabc /(?<=ab(c+)d)ef/ /(?<=ab(?<=c+)d)ef/ /(?<=ab(c|de)f)g/ /The next three are in testinput2 because they have variable length branches/ /(?<=bullock|donkey)-cart/I the bullock-cart a donkey-cart race *** Failers cart horse-and-cart /(?<=ab(?i)x|y|z)/I /(?>.*)(?<=(abcd)|(xyz))/I alphabetabcd endingxyz /(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I abxyZZ abXyZZ ZZZ zZZ bZZ BZZ *** Failers ZZ abXYZZ zzz bzz /(?[^()]+) # Either a sequence of non-brackets (no backtracking) | # Or (?R) # Recurse - i.e. nested bracketed string )* # Zero or more contents \) # Closing ) /Ix (abcd) (abcd)xyz xyz(abcd) (ab(xy)cd)pqr (ab(xycd)pqr () abc () 12(abcde(fsh)xyz(foo(bar))lmno)89 *** Failers abcd abcd) (abcd /\( ( (?>[^()]+) | (?R) )* \) /Igx (ab(xy)cd)pqr 1(abcd)(x(y)z)pqr /\( (?: (?>[^()]+) | (?R) ) \) /Ix (abcd) (ab(xy)cd) (a(b(c)d)e) ((ab)) *** Failers () /\( (?: (?>[^()]+) | (?R) )? \) /Ix () 12(abcde(fsh)xyz(foo(bar))lmno)89 /\( ( (?>[^()]+) | (?R) )* \) /Ix (ab(xy)cd) /\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix (ab(xy)cd) /\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix (ab(xy)cd) (123ab(xy)cd) /\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix (ab(xy)cd) (123ab(xy)cd) /\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix (ab(xy)cd) /\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix (abcd(xyz

qrs)123) /\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix (ab(cd)ef) (ab(cd(ef)gh)ij) /^[[:alnum:]]/IB /^[[:^alnum:]]/IB /^[[:alpha:]]/IB /^[[:^alpha:]]/IB /[_[:alpha:]]/I /^[[:ascii:]]/IB /^[[:^ascii:]]/IB /^[[:blank:]]/IB /^[[:^blank:]]/IB /[\n\x0b\x0c\x0d[:blank:]]/I /^[[:cntrl:]]/IB /^[[:digit:]]/IB /^[[:graph:]]/IB /^[[:lower:]]/IB /^[[:print:]]/IB /^[[:punct:]]/IB /^[[:space:]]/IB /^[[:upper:]]/IB /^[[:xdigit:]]/IB /^[[:word:]]/IB /^[[:^cntrl:]]/IB /^[12[:^digit:]]/IB /^[[:^blank:]]/IB /[01[:alpha:]%]/IB /[[.ch.]]/I /[[=ch=]]/I /[[:rhubarb:]]/I /[[:upper:]]/Ii A a /[[:lower:]]/Ii A a /((?-i)[[:lower:]])[[:lower:]]/Ii ab aB *** Failers Ab AB /[\200-\110]/I /^(?(0)f|b)oo/I # This one's here because of the large output vector needed /(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|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:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/I 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC\=ovector=300 # This one's here because Perl does this differently and PCRE2 can't at present /(main(O)?)+/I mainmain mainOmain # These are all cases where Perl does it differently (nested captures) /^(a(b)?)+$/I aba /^(aa(bb)?)+$/I aabbaa /^(aa|aa(bb))+$/I aabbaa /^(aa(bb)??)+$/I aabbaa /^(?:aa(bb)?)+$/I aabbaa /^(aa(b(b))?)+$/I aabbaa /^(?:aa(b(b))?)+$/I aabbaa /^(?:aa(b(?:b))?)+$/I aabbaa /^(?:aa(bb(?:b))?)+$/I aabbbaa /^(?:aa(b(?:bb))?)+$/I aabbbaa /^(?:aa(?:b(b))?)+$/I aabbaa /^(?:aa(?:b(bb))?)+$/I aabbbaa /^(aa(b(bb))?)+$/I aabbbaa /^(aa(bb(bb))?)+$/I aabbbbaa # ---------------- /#/IBx /a#/IBx /[\s]/IB /[\S]/IB /a(?i)b/IB ab aB *** Failers AB /(a(?i)b)/IB ab aB *** Failers AB / (?i)abc/IBx /#this is a comment (?i)abc/IBx /123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB /\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/IB /\Q\E/IB \ /\Q\Ex/IB / \Q\E/IB /a\Q\E/IB abc bca bac /a\Q\Eb/IB abc /\Q\Eabc/IB /x*+\w/IB *** Failers xxxxx /x?+/IB /x++/IB /x{1,3}+/B,no_auto_possess /x{1,3}+/Bi,no_auto_possess /[^x]{1,3}+/B,no_auto_possess /[^x]{1,3}+/Bi,no_auto_possess /(x)*+/IB /^(\w++|\s++)*$/I now is the time for all good men to come to the aid of the party *** Failers this is not a line with only words and spaces! /(\d++)(\w)/I 12345a *** Failers 12345+ /a++b/I aaab /(a++b)/I aaab /(a++)b/I aaab /([^()]++|\([^()]*\))+/I ((abc(ade)ufh()()x /\(([^()]++|\([^()]+\))+\)/I (abc) (abc(def)xyz) *** Failers ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /(abc){1,3}+/IB /a+?+/I /a{2,3}?+b/I /(?U)a+?+/I /a{2,3}?+b/I,ungreedy /x(?U)a++b/IB xaaaab /(?U)xa++b/IB xaaaab /^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/IB /^x(?U)a+b/IB /^x(?U)(a+)b/IB /[.x.]/I /[=x=]/I /[:x:]/I /\l/I /\L/I /\N{name}/I /\u/I /\U/I /a{1,3}b/ungreedy ab /[/I /[a-/I /[[:space:]/I /[\s]/IB /[[:space:]]/IB /[[:space:]abcde]/IB /< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/Ix <> hij> hij> def> *** Failers iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5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e)/IB abde acde /(?:a(?Pc(?Pd)))(?Pa)/IB /(?Pa)...(?P=a)bbb(?P>a)d/IB /^\W*(?:(?P(?P.)\W*(?P>one)\W*(?P=two)|)|(?P(?P.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii 1221 Satan, oscillate my metallic sonatas! A man, a plan, a canal: Panama! Able was I ere I saw Elba. *** Failers The quick brown fox /((?(R)a|b))\1(?1)?/I bb bbaa /(.*)a/Is /(.*)a\1/Is /(.*)a(b)\2/Is /((.*)a|(.*)b)z/Is /((.*)a|(.*)b)z\1/Is /((.*)a|(.*)b)z\2/Is /((.*)a|(.*)b)z\3/Is /((.*)a|^(.*)b)z\3/Is /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is /(a)(bc)/IB,no_auto_capture abc /(?Pa)(bc)/IB,no_auto_capture abc /(a)(?Pbc)/IB,no_auto_capture /(aaa(?C1)bbb|ab)/I aaabbb aaabbb\=callout_data=0 aaabbb\=callout_data=1 aaabbb\=callout_data=-1 /ab(?Pcd)ef(?Pgh)/I abcdefgh abcdefgh\=copy=1,get=two abcdefgh\=copy=one,copy=two abcdefgh\=copy=three /(?P)(?P)/IB /(?P)(?P)/IB /(?Pzz)(?Paa)/I zzaa\=copy=Z zzaa\=copy=A /(?Peks)(?Peccs)/I /(?Pabc(?Pdef)(?Pxyz))/I "\[((?P\d+)(,(?P>elem))*)\]"I [10,20,30,5,5,4,4,2,43,23,4234] *** Failers [] "\[((?P\d+)(,(?P>elem))*)?\]"I [10,20,30,5,5,4,4,2,43,23,4234] [] /(a(b(?2)c))?/IB /(a(b(?2)c))*/IB /(a(b(?2)c)){0,2}/IB /[ab]{1}+/IB /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii Baby Bjorn Active Carrier - With free SHIPPING!! /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii Baby Bjorn Active Carrier - With free SHIPPING!! /a*.*b/IB /(a|b)*.?c/IB /abc(?C255)de(?C)f/IB /abcde/IB,auto_callout abcde abcdfe /a*b/IB,auto_callout ab aaaab aaaacb /a*b/IB,auto_callout ab aaaab aaaacb /a+b/IB,auto_callout ab aaaab aaaacb /(abc|def)x/IB,auto_callout abcx defx ** Failers abcdefzx /(abc|def)x/IB,auto_callout abcx defx ** Failers abcdefzx /(ab|cd){3,4}/I,auto_callout ababab abcdabcd abcdcdcdcdcd /([ab]{,4}c|xy)/IB,auto_callout Note: that { does NOT introduce a quantifier /([ab]{,4}c|xy)/IB,auto_callout Note: that { does NOT introduce a quantifier /([ab]{1,4}c|xy){4,5}?123/IB,auto_callout aacaacaacaacaac123 /\b.*/I ab cd\=offset=1 /\b.*/Is ab cd\=offset=1 /(?!.bcd).*/I Xbcd12345 /abcde/I ab\=ps abc\=ps abcd\=ps abcde\=ps the quick brown abc\=ps ** Failers\=ps the quick brown abxyz fox\=ps "^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I 13/05/04\=ps 13/5/2004\=ps 02/05/09\=ps 1\=ps 1/2\=ps 1/2/0\=ps 1/2/04\=ps 0\=ps 02/\=ps 02/0\=ps 02/1\=ps ** Failers\=ps \=ps 123\=ps 33/4/04\=ps 3/13/04\=ps 0/1/2003\=ps 0/\=ps 02/0/\=ps 02/13\=ps /0{0,2}ABC/I /\d{3,}ABC/I /\d*ABC/I /[abc]+DE/I /[abc]?123/I 123\=ps a\=ps b\=ps c\=ps c12\=ps c123\=ps /^(?:\d){3,5}X/I 1\=ps 123\=ps 123X 1234\=ps 1234X 12345\=ps 12345X *** Failers 1X 123456\=ps "<(\w+)/?>(.)*"Igms \n\n\nPartner der LCO\nde\nPartner der LINEAS Consulting\nGmbH\nLINEAS Consulting GmbH Hamburg\nPartnerfirmen\n30 days\nindex,follow\n\nja\n3\nPartner\n\n\nLCO\nLINEAS Consulting\n15.10.2003\n\n\n\n\nDie Partnerfirmen der LINEAS Consulting\nGmbH\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\=jitstack=1024 /line\nbreak/I this is a line\nbreak line one\nthis is a line\nbreak in the second line /line\nbreak/I,firstline this is a line\nbreak ** Failers line one\nthis is a line\nbreak in the second line /line\nbreak/Im,firstline this is a line\nbreak ** Failers line one\nthis is a line\nbreak in the second line /(?i)(?-i)AbCd/I AbCd ** Failers abcd /a{11111111111111111111}/I /(){64294967295}/I /(){2,4294967295}/I "(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I abcdefghijklAkB "(?Pa)(?Pb)(?Pc)(?Pd)(?Pe)(?Pf)(?Pg)(?Ph)(?Pi)(?Pj)(?Pk)(?Pl)A\11B"I abcdefghijklAkB "(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I abcdefghijklAkB "(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)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and)that (this(and)that) (this(and)that)stuff /[^()]*(?:\((?>(?R))\)[^()]*)*/I (this(and)that (this(and)that) /[^()]*(?:\((?R)\))*[^()]*/I (this(and)that (this(and)that) /(?:\((?R)\))*[^()]*/I (this(and)that (this(and)that) ((this)) /(?:\((?R)\))|[^()]*/I (this(and)that (this(and)that) (this) ((this)) /\x{0000ff}/I /^((?Pa1)|(?Pa2)b)/I /^((?Pa1)|(?Pa2)b)/I,dupnames a1b\=copy=A a2b\=copy=A ** Failers a1b\=copy=Z,copy=A /(?|(?)(?)(?)|(?)(?)(?))/I,dupnames /^(?Pa)(?Pb)/I,dupnames ab\=copy=A /^(?Pa)(?Pb)|cd/I,dupnames ab\=copy=A cd\=copy=A /^(?Pa)(?Pb)|cd(?Pef)(?Pgh)/I,dupnames cdefgh\=copy=A /^((?Pa1)|(?Pa2)b)/I,dupnames a1b\=get=A a2b\=get=A ** Failers a1b\=get=Z,get=A /^(?Pa)(?Pb)/I,dupnames ab\=get=A /^(?Pa)(?Pb)|cd/I,dupnames ab\=get=A cd\=get=A /^(?Pa)(?Pb)|cd(?Pef)(?Pgh)/I,dupnames cdefgh\=get=A /(?J)^((?Pa1)|(?Pa2)b)/I a1b\=copy=A a2b\=copy=A /^(?Pa) (?J:(?Pb)(?Pc)) (?Pd)/I / In this next test, J is not set at the outer level; consequently it isn't set in the pattern's options; consequently pcre_get_named_substring() produces a random value. /Ix /^(?Pa) (?J:(?Pb)(?Pc)) (?Pd)/I a bc d\=copy=A,copy=B,copy=C /^(?Pa)?(?(A)a|b)/I aabc bc ** Failers abc /(?:(?(ZZ)a|b)(?PX))+/I bXaX /(?:(?(2y)a|b)(X))+/I /(?:(?(ZA)a|b)(?PX))+/I /(?:(?(ZZ)a|b)(?(ZZ)a|b)(?PX))+/I bbXaaX /(?:(?(ZZ)a|\(b\))\\(?PX))+/I (b)\\Xa\\X /(?PX|Y))+/I bXXaYYaY bXYaXXaX /()()()()()()()()()(?:(?(A)(?P=A)a|b)(?PX|Y))+/I bXXaYYaY /\s*,\s*/I \x0b,\x0b \x0c,\x0d /^abc/Im,newline=lf xyz\nabc xyz\r\nabc ** Failers xyz\rabc xyzabc\r xyzabc\rpqr xyzabc\r\n xyzabc\r\npqr /^abc/Im,newline=crlf xyz\r\nabclf> ** Failers xyz\nabclf xyz\rabclf /^abc/Im,newline=cr xyz\rabc ** Failers xyz\nabc xyz\r\nabc /^abc/Im,newline=bad /.*/I,newline=lf abc\ndef abc\rdef abc\r\ndef /.*/I,newline=cr abc\ndef abc\rdef abc\r\ndef /.*/I,newline=crlf abc\ndef abc\rdef abc\r\ndef /\w+(.)(.)?def/Is abc\ndef abc\rdef abc\r\ndef /(?P25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I /()()()()()()()()()()()()()()()()()()()() ()()()()()()()()()()()()()()()()()()()() ()()()()()()()()()()()()()()()()()()()() ()()()()()()()()()()()()()()()()()()()() ()()()()()()()()()()()()()()()()()()()() (.(.))/Ix XY\=ovector=133 /(a*b|(?i:c*(?-i)d))/I /()[ab]xyz/I /(|)[ab]xyz/I /(|c)[ab]xyz/I /(|c?)[ab]xyz/I /(d?|c?)[ab]xyz/I /(d?|c)[ab]xyz/I /^a*b\d/IB /^a*+b\d/IB /^a*?b\d/IB /^a+A\d/IB aaaA5 ** Failers aaaa5 /^a*A\d/IBi aaaA5 aaaa5 /(a*|b*)[cd]/I /(a+|b*)[cd]/I /(a*|b+)[cd]/I /(a+|b+)[cd]/I /(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( ((( a )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))) /Ix large nest /a*\d/B /a*\D/B /0*\d/B /0*\D/B /a*\s/B /a*\S/B / *\s/B / *\S/B /a*\w/B /a*\W/B /=*\w/B /=*\W/B /\d*a/B /\d*2/B /\d*\d/B /\d*\D/B /\d*\s/B /\d*\S/B /\d*\w/B /\d*\W/B /\D*a/B /\D*2/B /\D*\d/B /\D*\D/B /\D*\s/B /\D*\S/B /\D*\w/B /\D*\W/B /\s*a/B /\s*2/B /\s*\d/B /\s*\D/B /\s*\s/B /\s*\S/B /\s*\w/B /\s*\W/B /\S*a/B /\S*2/B /\S*\d/B /\S*\D/B /\S*\s/B /\S*\S/B /\S*\w/B /\S*\W/B /\w*a/B /\w*2/B /\w*\d/B /\w*\D/B /\w*\s/B /\w*\S/B /\w*\w/B /\w*\W/B /\W*a/B /\W*2/B /\W*\d/B /\W*\D/B /\W*\s/B /\W*\S/B /\W*\w/B /\W*\W/B /[^a]+a/B /[^a]+a/Bi /[^a]+A/Bi /[^a]+b/B /[^a]+\d/B /a*[^a]/B /(?Px)(?Py)/I xy\=copy=abc,copy=xyz /(?x)(?'xyz'y)/I xy\=copy=abc,copy=xyz /(?x)(?'xyz>y)/I /(?P'abc'x)(?Py)/I /^(?:(?(ZZ)a|b)(?X))+/ bXaX bXbX ** Failers aXaX aXbX /^(?P>abc)(?xxx)/ /^(?P>abc)(?x|y)/ xx xy yy yx /^(?P>abc)(?Px|y)/ xx xy yy yx /^((?(abc)a|b)(?x|y))+/ bxay bxby ** Failers axby /^(((?P=abc)|X)(?x|y))+/ XxXxxx XxXyyx XxXyxx ** Failers x /^(?1)(abc)/ abcabc /^(?:(?:\1|X)(a|b))+/ Xaaa Xaba /^[\E\Qa\E-\Qz\E]+/B /^[a\Q]bc\E]/B /^[a-\Q\E]/B /^(?P>abc)[()](?)/B /^((?(abc)y)[()](?Px))+/B (xy)x /^(?P>abc)\Q()\E(?)/B /^(?P>abc)[a\Q(]\E(](?)/B /^(?P>abc) # this is (a comment) (?)/Bx /^\W*(?:(?(?.)\W*(?&one)\W*\k|)|(?(?.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii 1221 Satan, oscillate my metallic sonatas! A man, a plan, a canal: Panama! Able was I ere I saw Elba. *** Failers The quick brown fox /(?=(\w+))\1:/I abcd: /(?=(?'abc'\w+))\k:/I abcd: /(?'abc'a|b)(?d|e)\k{2}/dupnames adaa ** Failers addd adbb /(?'abc'a|b)(?d|e)(?&abc){2}/dupnames bdaa bdab ** Failers bddd /(?( (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x abcabc1Xabc2XabcXabcabc /(? (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x /^(?(DEFINE) abc | xyz ) /x /(?(DEFINE) abc) xyz/Ix /(a|)*\d/ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\=ovector=0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4\=ovector=0 /^a.b/newline=lf a\rb ** Failers a\nb /^a.b/newline=cr a\nb ** Failers a\rb /^a.b/newline=anycrlf a\x85b ** Failers a\rb /^a.b/newline=any ** Failers a\nb a\rb a\x85b /^abc./gmx,newline=any abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x85abc7 JUNK /abc.$/gmx,newline=any abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc7 abc9 /^a\Rb/bsr=unicode a\nb a\rb a\r\nb a\x0bb a\x0cb a\x85b ** Failers a\n\rb /^a\R*b/bsr=unicode ab a\nb a\rb a\r\nb a\x0bb a\x0cb a\x85b a\n\rb a\n\r\x85\x0cb /^a\R+b/bsr=unicode a\nb a\rb a\r\nb a\x0bb a\x0cb a\x85b a\n\rb a\n\r\x85\x0cb ** Failers ab /^a\R{1,3}b/bsr=unicode a\nb a\n\rb a\n\r\x85b a\r\n\r\nb a\r\n\r\n\r\nb a\n\r\n\rb a\n\n\r\nb ** Failers a\n\n\n\rb a\r /(?&abc)X(?P)/I abcPXP123 /(?1)X(?P)/I abcPXP123 /(?:a(?&abc)b)*(?x)/ 123axbaxbaxbx456 123axbaxbaxb456 /(?:a(?&abc)b){1,5}(?x)/ 123axbaxbaxbx456 /(?:a(?&abc)b){2,5}(?x)/ 123axbaxbaxbx456 /(?:a(?&abc)b){2,}(?x)/ 123axbaxbaxbx456 /(abc)(?i:(?1))/ defabcabcxyz DEFabcABCXYZ /(abc)(?:(?i)(?1))/ defabcabcxyz DEFabcABCXYZ /^(a)\g-2/ /^(a)\g/ /^(a)\g{0}/ /^(a)\g{3/ /^(a)\g{aa}/ /^a.b/newline=lf a\rb *** Failers a\nb /.+foo/ afoo ** Failers \r\nfoo \nfoo /.+foo/newline=crlf afoo \nfoo ** Failers \r\nfoo /.+foo/newline=any afoo ** Failers \nfoo \r\nfoo /.+foo/s afoo \r\nfoo \nfoo /^$/gm,newline=any abc\r\rxyz abc\n\rxyz ** Failers abc\r\nxyz /(?m)^$/g,newline=any,aftertext abc\r\n\r\n /(?m)^$|^\r\n/g,newline=any,aftertext abc\r\n\r\n /(?m)$/g,newline=any,aftertext abc\r\n\r\n /abc.$/gmx,newline=anycrlf abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x85 abc9 /^X/m XABC ** Failers XABC\=notbol /(ab|c)(?-1)/B abc /xy(?+1)(abc)/B xyabcabc ** Failers xyabc /x(?-0)y/ /x(?-1)y/ /x(?+0)y/ /x(?+1)y/ /^(abc)?(?(-1)X|Y)/B abcX Y ** Failers abcY /^((?(+1)X|Y)(abc))+/B YabcXabc YabcXabcXabc ** Failers XabcXabc /(?(-1)a)/B /((?(-1)a))/B /((?(-2)a))/B /^(?(+1)X|Y)(.)/B Y! /(?tom|bon)-\k{A}/ tom-tom bon-bon ** Failers tom-bon /\g{A/ /(?|(abc)|(xyz))/B >abc< >xyz< /(x)(?|(abc)|(xyz))(x)/B xabcx xxyzx /(x)(?|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)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)0)\=jitstack=1024 /[\E]AAA/ /[\Q\E]AAA/ /[^\E]AAA/ /[^\Q\E]AAA/ /[\E^]AAA/ /[\Q\E^]AAA/ /A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B /^a+(*FAIL)/auto_callout aaaaaa /a+b?c+(*FAIL)/auto_callout aaabccc /a+b?(*PRUNE)c+(*FAIL)/auto_callout aaabccc /a+b?(*COMMIT)c+(*FAIL)/auto_callout aaabccc /a+b?(*SKIP)c+(*FAIL)/auto_callout aaabcccaaabccc /a+b?(*THEN)c+(*FAIL)/auto_callout aaabccc /a(*MARK)b/ /(?i:A{1,}\6666666666)/ /\g6666666666/ /[\g6666666666]/B /(?1)\c[/ /.+A/newline=crlf \r\nA /\nA/newline=crlf \r\nA /[\r\n]A/newline=crlf \r\nA /(\r|\n)A/newline=crlf \r\nA /a(*CR)b/ /(*CR)a.b/ a\nb ** Failers a\rb /(*CR)a.b/newline=lf a\nb ** Failers a\rb /(*LF)a.b/newline=CRLF a\rb ** Failers a\nb /(*CRLF)a.b/ a\rb a\nb ** Failers a\r\nb /(*ANYCRLF)a.b/newline=CR ** Failers a\rb a\nb a\r\nb /(*ANY)a.b/newline=cr ** Failers a\rb a\nb a\r\nb a\x85b /(*ANY).*/g abc\r\ndef /(*ANYCRLF).*/g abc\r\ndef /(*CRLF).*/g abc\r\ndef /a\Rb/I,bsr=anycrlf a\rb a\nb a\r\nb ** Failers a\x85b a\x0bb /a\Rb/I,bsr=unicode a\rb a\nb a\r\nb a\x85b a\x0bb /a\R?b/I,bsr=anycrlf a\rb a\nb a\r\nb ** Failers a\x85b a\x0bb /a\R?b/I,bsr=unicode a\rb a\nb a\r\nb a\x85b a\x0bb /a\R{2,4}b/I,bsr=anycrlf a\r\n\nb a\n\r\rb a\r\n\r\n\r\n\r\nb ** Failers a\x85\x85b a\x0b\x0bb /a\R{2,4}b/I,bsr=unicode a\r\rb a\n\n\nb a\r\n\n\r\rb a\x85\x85b a\x0b\x0bb ** Failers a\r\r\r\r\rb /(*BSR_ANYCRLF)a\Rb/I a\nb a\rb /(*BSR_UNICODE)a\Rb/I a\x85b /(*BSR_ANYCRLF)(*CRLF)a\Rb/I a\nb a\rb /(*CRLF)(*BSR_UNICODE)a\Rb/I a\x85b /(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I /(?)(?&)/ /(?)(?&a)/ /(?)(?&aaaaaaaaaaaaaaaaaaaaaaa)/ /(?+-a)/ /(?-+a)/ /(?(-1))/ /(?(+10))/ /(?(10))/ /(?(+2))()()/ /(?(2))()()/ /\k''/ /\k<>/ /\k{}/ /\k/ /\kabc/ /(?P=)/ /(?P>)/ /(?!\w)(?R)/ /(?=\w)(?R)/ /(?x|y){0}z/ xzxx yzyy ** Failers xxz /(\3)(\1)(a)/ cat /(\3)(\1)(a)/alt_bsux,allow_empty_class,match_unset_backref,dupnames cat /TA]/ The ACTA] comes /TA]/alt_bsux,allow_empty_class,match_unset_backref,dupnames The ACTA] comes /(?2)[]a()b](abc)/ abcbabc /(?2)[^]a()b](abc)/ abcbabc /(?1)[]a()b](abc)/ abcbabc ** Failers abcXabc /(?1)[^]a()b](abc)/ abcXabc ** Failers abcbabc /(?2)[]a()b](abc)(xyz)/ xyzbabcxyz /(?&N)[]a(?)](?abc)/ abc)](abc)/ abcY)/ XYabcdY /Xa{2,4}b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /Xa{2,4}?b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /Xa{2,4}+b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /X\d{2,4}b/ X\=ps X3\=ps X33\=ps X333\=ps X3333\=ps /X\d{2,4}?b/ X\=ps X3\=ps X33\=ps X333\=ps X3333\=ps /X\d{2,4}+b/ X\=ps X3\=ps X33\=ps X333\=ps X3333\=ps /X\D{2,4}b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /X\D{2,4}?b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /X\D{2,4}+b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /X[abc]{2,4}b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /X[abc]{2,4}?b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /X[abc]{2,4}+b/ X\=ps Xa\=ps Xaa\=ps Xaaa\=ps Xaaaa\=ps /X[^a]{2,4}b/ X\=ps Xz\=ps Xzz\=ps Xzzz\=ps Xzzzz\=ps /X[^a]{2,4}?b/ X\=ps Xz\=ps Xzz\=ps Xzzz\=ps Xzzzz\=ps /X[^a]{2,4}+b/ X\=ps Xz\=ps Xzz\=ps Xzzz\=ps Xzzzz\=ps /(Y)X\1{2,4}b/ YX\=ps YXY\=ps YXYY\=ps YXYYY\=ps YXYYYY\=ps /(Y)X\1{2,4}?b/ YX\=ps YXY\=ps YXYY\=ps YXYYY\=ps YXYYYY\=ps /(Y)X\1{2,4}+b/ YX\=ps YXY\=ps YXYY\=ps YXYYY\=ps YXYYYY\=ps /\++\KZ|\d+X|9+Y/startchar ++++123999\=ps ++++123999Y\=ps ++++Z1234\=ps /Z(*F)/ Z\=ps ZA\=ps /Z(?!)/ Z\=ps ZA\=ps /dog(sbody)?/ dogs\=ps dogs\=ph /dog(sbody)??/ dogs\=ps dogs\=ph /dog|dogsbody/ dogs\=ps dogs\=ph /dogsbody|dog/ dogs\=ps dogs\=ph /\bthe cat\b/ the cat\=ps the cat\=ph /abc/ abc\=ps abc\=ph /abc\K123/startchar xyzabc123pqr xyzabc12\=ps xyzabc12\=ph /(?<=abc)123/ xyzabc123pqr xyzabc12\=ps xyzabc12\=ph /\babc\b/ +++abc+++ +++ab\=ps +++ab\=ph /(?&word)(?&element)(?(DEFINE)(?<[^m][^>]>[^<])(?\w*+))/B /(?&word)(?&element)(?(DEFINE)(?<[^\d][^>]>[^<])(?\w*+))/B /(ab)(x(y)z(cd(*ACCEPT)))pq/B /abc\K/aftertext,startchar abcdef abcdef\=notempty_atstart xyzabcdef\=notempty_atstart ** Failers abcdef\=notempty xyzabcdef\=notempty /^(?:(?=abc)|abc\K)/aftertext,startchar abcdef abcdef\=notempty_atstart ** Failers abcdef\=notempty /a?b?/aftertext xyz xyzabc xyzabc\=notempty xyzabc\=notempty_atstart xyz\=notempty_atstart ** Failers xyz\=notempty /^a?b?/aftertext xyz xyzabc ** Failers xyzabc\=notempty xyzabc\=notempty_atstart xyz\=notempty_atstart xyz\=notempty /^(?a|b\gc)/ aaaa bacxxx bbaccxxx bbbacccxx /^(?a|b\g'name'c)/ aaaa bacxxx bbaccxxx bbbacccxx /^(a|b\g<1>c)/ aaaa bacxxx bbaccxxx bbbacccxx /^(a|b\g'1'c)/ aaaa bacxxx bbaccxxx bbbacccxx /^(a|b\g'-1'c)/ aaaa bacxxx bbaccxxx bbbacccxx /(^(a|b\g<-1>c))/ aaaa bacxxx bbaccxxx bbbacccxx /(?-i:\g)(?i:(?a))/ XaaX XAAX /(?i:\g)(?-i:(?a))/ XaaX ** Failers XAAX /(?-i:\g<+1>)(?i:(a))/ XaaX XAAX /(?=(?(?#simplesyntax)\$(?[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)(?:\[(?[a-zA-Z0-9_\x{7f}-\x{ff}]+|\$\g)\]|->\g(\(.*?\))?)?|(?#simple syntax withbraces)\$\{(?:\g(?\[(?:\g|'(?:\\.|[^'\\])*'|"(?:\g|\\.|[^"\\])*")\])?|\g|\$\{\g\})\}|(?#complexsyntax)\{(?\$(?\g(\g*|\(.*?\))?)(?:->\g)*|\$\g|\$\{\g\})\}))\{/ /(?a|b|c)\g*/ abc accccbbb /^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)/ XYabcdY /(?<=b(?1)|zzz)(a)/ xbaax xzzzax /(a)(?<=b\1)/ /(a)(?<=b+(?1))/ /(a+)(?<=b(?1))/ /(a(?<=b(?1)))/ /(?<=b(?1))xyz/ /(?<=b(?1))xyz(b+)pqrstuvew/ /(a|bc)\1/I /(a|bc)\1{2,3}/I /(a|bc)(?1)/I /(a|b\1)(a|b\1)/I /(a|b\1){2}/I /(a|bbbb\1)(a|bbbb\1)/I /(a|bbbb\1){2}/I /^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]/I /]{0,})>]{0,})>([\d]{0,}\.)(.*)((
([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/Iis "(?>.*/)foo"I /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /Ix /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I /A)|(?
B))/I AB\=copy=a BA\=copy=a /(?|(?A)|(?B))/ /(?:a(? (?')|(?")) | b(? (?')|(?")) ) (?('quote')[a-z]+|[0-9]+)/Ix,dupnames a"aaaaa b"aaaaa ** Failers b"11111 a"11111 /^(?|(a)(b)(c)(?d)|(?e)) (?('D')X|Y)/IBx,dupnames abcdX eX ** Failers abcdY ey /(?a) (b)(c) (?d (?(R&A)$ | (?4)) )/IBx,dupnames abcdd ** Failers abcdde /abcd*/ xxxxabcd\=ps xxxxabcd\=ph /abcd*/i xxxxabcd\=ps xxxxabcd\=ph XXXXABCD\=ps XXXXABCD\=ph /abc\d*/ xxxxabc1\=ps xxxxabc1\=ph /(a)bc\1*/ xxxxabca\=ps xxxxabca\=ph /abc[de]*/ xxxxabcde\=ps xxxxabcde\=ph # This is not in the Perl-compatible test because Perl seems currently to be # broken and not behaving as specified in that it *does* bumpalong after # hitting (*COMMIT). /(?1)(A(*COMMIT)|B)D/ ABD XABD BAD ABXABD ** Failers ABX BAXBAD /(\3)(\1)(a)/alt_bsux,allow_empty_class,match_unset_backref,dupnames cat /(\3)(\1)(a)/I,alt_bsux,allow_empty_class,match_unset_backref,dupnames cat /(\3)(\1)(a)/I cat /i(?(DEFINE)(?a))/I i /()i(?(1)a)/I ia /(?i)a(?-i)b|c/B XabX XAbX CcC ** Failers XABX /(?i)a(?s)b|c/B /(?i)a(?s-i)b|c/B /^(ab(c\1)d|x){2}$/B xabcxd /^(?&t)*+(?(DEFINE)(?.))$/B /^(?&t)*(?(DEFINE)(?.))$/B / -- This one is here because Perl gives the match as "b" rather than "ab". I believe this to be a Perl bug. --/ /(?>a\Kb)z|(ab)/ ab\=startchar /(?P(?P0|)|(?P>L2)(?P>L1))/ /abc(*MARK:)pqr/ /abc(*:)pqr/ /abc(*FAIL:123)xyz/ # This should, and does, fail. In Perl, it does not, which I think is a # bug because replacing the B in the pattern by (B|D) does make it fail. /A(*COMMIT)B/aftertext,mark ACABX # These should be different, but in Perl they are not, which I think # is a bug in Perl. /A(*THEN)B|A(*THEN)C/mark AC /A(*PRUNE)B|A(*PRUNE)C/mark AC # Mark names can be duplicated. Perl doesn't give a mark for this one, # though PCRE2 does. /^A(*:A)B|^X(*:A)Y/mark ** Failers XAQQ # COMMIT at the start of a pattern should be the same as an anchor. Perl # optimizations defeat this. So does the PCRE2 optimization unless we disable # it. /(*COMMIT)ABC/ ABCDEFG /(*COMMIT)ABC/no_start_optimize ** Failers DEFGABC /^(ab (c+(*THEN)cd) | xyz)/x abcccd /^(ab (c+(*PRUNE)cd) | xyz)/x abcccd /^(ab (c+(*FAIL)cd) | xyz)/x abcccd # Perl gets some of these wrong /(?>.(*ACCEPT))*?5/ abcde /(.(*ACCEPT))*?5/ abcde /(.(*ACCEPT))5/ abcde /(.(*ACCEPT))*5/ abcde /A\NB./B ACBD *** Failers A\nB ACB\n /A\NB./Bs ACBD ACB\n *** Failers A\nB /A\NB/newline=crlf A\nB A\rB ** Failers A\r\nB /\R+b/B /\R+\n/B /\R+\d/B /\d*\R/B /\s*\R/B \x20\x0a \x20\x0d \x20\x0d\x0a /\S*\R/B a\x0a /X\h*\R/B X\x20\x0a /X\H*\R/B X\x0d\x0a /X\H+\R/B X\x0d\x0a /X\H++\R/B X\x0d\x0a /(?<=abc)def/ abc\=ph /abc$/ abc abc\=ps abc\=ph /abc$/m abc abc\n abc\=ph abc\n\=ph abc\=ps abc\n\=ps /abc\z/ abc abc\=ps abc\=ph /abc\Z/ abc abc\=ps abc\=ph /abc\b/ abc abc\=ps abc\=ph /abc\B/ abc abc\=ps abc\=ph /.+/ abc\=offset=0 abc\=offset=1 abc\=offset=2 abc\=offset=3 abc\=offset=4 abc\=offset=-4 /^\cģ/ /(?P(?P=abn)xxx)/B /(a\1z)/B /(?P(?P=abn)(?(?P=axn)xxx)/B /(?P(?P=axn)xxx)(?yy)/B # These tests are here because Perl gets the first one wrong. /(\R*)(.)/s \r\n \r\r\n\n\r \r\r\n\n\r\n /(\R)*(.)/s \r\n \r\r\n\n\r \r\r\n\n\r\n /((?>\r\n|\n|\x0b|\f|\r|\x85)*)(.)/s \r\n \r\r\n\n\r \r\r\n\n\r\n # ------------- /^abc$/B /^abc$/Bm /^(a)*+(\w)/ aaaaX ** Failers aaaa /^(?:a)*+(\w)/ aaaaX ** Failers aaaa /(a)++1234/IB /([abc])++1234/I /(?<=(abc)+)X/ /(^ab)/I /(^ab)++/I /(^ab|^)+/I /(^ab|^)++/I /(?:^ab)/I /(?:^ab)++/I /(?:^ab|^)+/I /(?:^ab|^)++/I /(.*ab)/I /(.*ab)++/I /(.*ab|.*)+/I /(.*ab|.*)++/I /(?:.*ab)/I /(?:.*ab)++/I /(?:.*ab|.*)+/I /(?:.*ab|.*)++/I /(?=a)[bcd]/I /((?=a))[bcd]/I /((?=a))+[bcd]/I /((?=a))++[bcd]/I /(?=a+)[bcd]/Ii /(?=a+?)[bcd]/Ii /(?=a++)[bcd]/Ii /(?=a{3})[bcd]/Ii /(abc)\1+/ # Perl doesn't get these right IMO (the 3rd is PCRE2-specific) /(?1)(?:(b(*ACCEPT))){0}/ b /(?1)(?:(b(*ACCEPT))){0}c/ bc ** Failers b /(?1)(?:((*ACCEPT))){0}c/ c c\=notempty /^.*?(?(?=a)a|b(*THEN)c)/ ba /^.*?(?(?=a)a|bc)/ ba /^.*?(?(?=a)a(*THEN)b|c)/ ac /^.*?(?(?=a)a(*THEN)b)c/ ac /^.*?(a(*THEN)b)c/ aabc /^.*? (?1) c (?(DEFINE)(a(*THEN)b))/x aabc /^.*?(a(*THEN)b|z)c/ aabc /^.*?(z|a(*THEN)b)c/ aabc # These are here because they are not Perl-compatible; the studying means the # mark is not seen. /(*MARK:A)(*SKIP:B)(C|X)/mark C D /(*:A)A+(*SKIP:A)(B|Z)/mark AAAC # ---------------------------- "(?=a*(*ACCEPT)b)c" c c\=notempty /(?1)c(?(DEFINE)((*ACCEPT)b))/ c c\=notempty /(?>(*ACCEPT)b)c/ c c\=notempty /(?:(?>(a)))+a%/allaftertext %aa% /(a)b|ac/allaftertext ac\=ovector=1 /(a)(b)x|abc/allaftertext abc\=ovector=2 /(a)bc|(a)(b)\2/ abc\=ovector=1 abc\=ovector=2 aba\=ovector=1 aba\=ovector=2 aba\=ovector=3 aba\=ovector=4 /(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I /(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I /(a(?2)|b)(b(?1)|a)(?1)(?2)/I /(abc)(?1)/I /(?:(foo)|(bar)|(baz))X/allcaptures bazfooX foobazbarX barfooX bazX foobarbazX bazfooX\=ovector=0 bazfooX\=ovector=1 bazfooX\=ovector=2 bazfooX\=ovector=3 /(?=abc){3}abc/B /(?=abc)+abc/B /(?=abc)++abc/B /(?=abc){0}xyz/B /(?=(a))?./B /(?=(a))??./B /^(?=(a)){0}b(?1)/B /(?(DEFINE)(a))?b(?1)/B /^(?=(?1))?[az]([abc])d/B /^(?!a){0}\w+/B /(?<=(abc))?xyz/B /[:a[:abc]b:]/B /(a+|(?R)b)/ /^(a(*:A)(d|e(*:B))z|aeq)/auto_callout adz aez aeqwerty /.(*F)/ abc\=ph /\btype\b\W*?\btext\b\W*?\bjavascript\b/I /\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|a+)(?>(z+))\w/B aaaazzzzb ** Failers aazz /(.)(\1|a(?2))/ bab /\1|(.)(?R)\1/ cbbbc /(.)((?(1)c|a)|a(?2))/ baa /(?P(?P=abn)xxx)/B /(a\1z)/B /^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames aAz *** Failers ax41z /^a[m\x41]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames aAz /^a\x1z/alt_bsux,allow_empty_class,match_unset_backref,dupnames ax1z /^a\u0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames aAz *** Failers au0041z /^a[m\u0041]z/alt_bsux,allow_empty_class,match_unset_backref,dupnames aAz /^a\u041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames au041z *** Failers aAz /^a\U0041z/alt_bsux,allow_empty_class,match_unset_backref,dupnames aU0041z *** Failers aAz /(?(?=c)c|d)++Y/B /(?(?=c)c|d)*+Y/B /a[\NB]c/ aNc /a[B-\Nc]/ /a[B\Nc]/ /(a)(?2){0,1999}?(b)/ /(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/ # This test, with something more complicated than individual letters, causes # different behaviour in Perl. Perhaps it disables some optimization; no tag is # passed back for the failures, whereas in PCRE2 there is a tag. /(A|P)(*:A)(B|P) | (X|P)(X|P)(*:B)(Y|P)/x,mark AABC XXYZ ** Failers XAQQ XAQQXZZ AXQQQ AXXQQQ # Perl doesn't give marks for these, though it does if the alternatives are # replaced by single letters. /(b|q)(*:m)f|a(*:n)w/mark aw ** Failers abc /(q|b)(*:m)f|a(*:n)w/mark aw ** Failers abc # After a partial match, the behaviour is as for a failure. /^a(*:X)bcde/mark abc\=ps # These are here because Perl doesn't return a mark, except for the first. /(?=(*:x))(q|)/aftertext,mark abc /(?=(*:x))((*:y)q|)/aftertext,mark abc /(?=(*:x))(?:(*:y)q|)/aftertext,mark abc /(?=(*:x))(?>(*:y)q|)/aftertext,mark abc /(?=a(*:x))(?!a(*:y)c)/aftertext,mark ab /(?=a(*:x))(?=a(*:y)c|)/aftertext,mark ab /(..)\1/ ab\=ps aba\=ps abab\=ps /(..)\1/i ab\=ps abA\=ps aBAb\=ps /(..)\1{2,}/ ab\=ps aba\=ps abab\=ps ababa\=ps ababab\=ps ababab\=ph abababa\=ps abababa\=ph /(..)\1{2,}/i ab\=ps aBa\=ps aBAb\=ps AbaBA\=ps abABAb\=ps aBAbaB\=ph abABabA\=ps abaBABa\=ph /(..)\1{2,}?x/i ab\=ps abA\=ps aBAb\=ps abaBA\=ps abAbaB\=ps abaBabA\=ps abAbABaBx\=ps /^(..)\1/ aba\=ps /^(..)\1{2,3}x/ aba\=ps ababa\=ps ababa\=ph abababx ababababx /^(..)\1{2,3}?x/ aba\=ps ababa\=ps ababa\=ph abababx ababababx /^(..)(\1{2,3})ab/ abababab /^\R/ \r\=ps \r\=ph /^\R{2,3}x/ \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph \r\rx \r\r\rx /^\R{2,3}?x/ \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph \r\rx \r\r\rx /^\R?x/ \r\=ps \r\=ph x \rx /^\R+x/ \r\=ps \r\=ph \r\n\=ps \r\n\=ph \rx /^a$/newline=crlf a\r\=ps a\r\=ph /^a$/m,newline=crlf a\r\=ps a\r\=ph /^(a$|a\r)/newline=crlf a\r\=ps a\r\=ph /^(a$|a\r)/m,newline=crlf a\r\=ps a\r\=ph /./newline=crlf \r\=ps \r\=ph /.{2,3}/newline=crlf \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph /.{2,3}?/newline=crlf \r\=ps \r\=ph \r\r\=ps \r\r\=ph \r\r\r\=ps \r\r\r\=ph "AB(C(D))(E(F))?(?(?=\2)(?=\4))" ABCDGHI\=ovector=01 # These are all run as real matches in test 1; here we are just checking the # settings of the anchored and startline bits. /(?>.*?a)(?<=ba)/I /(?:.*?a)(?<=ba)/I /.*?a(*PRUNE)b/I /.*?a(*PRUNE)b/Is /^a(*PRUNE)b/Is /.*?a(*SKIP)b/I /(?>.*?a)b/Is /(?>.*?a)b/I /(?>^a)b/Is /(?>.*?)(?<=(abcd)|(wxyz))/I /(?>.*)(?<=(abcd)|(wxyz))/I "(?>.*)foo"I "(?>.*?)foo"I /(?>^abc)/Im /(?>.*abc)/Im /(?:.*abc)/Im /(?:(a)+(?C1)bb|aa(?C2)b)/ aab\=callout_capture /(?:(a)++(?C1)bb|aa(?C2)b)/ aab\=callout_capture /(?:(?>(a))(?C1)bb|aa(?C2)b)/ aab\=callout_capture /(?:(?1)(?C1)x|ab(?C2))((a)){0}/ aab\=callout_capture /(?1)(?C1)((a)(?C2)){0}/ aab\=callout_capture /(?:(a)+(?C1)bb|aa(?C2)b)++/ aab\=callout_capture aab\=callout_capture,ovector=1 /(ab)x|ab/ ab\=ovector=0 ab\=ovector=1 /(?<=123)(*MARK:xx)abc/mark xxxx123a\=ph xxxx123a\=ps /123\Kabc/startchar xxxx123a\=ph xxxx123a\=ps /^(?(?=a)aa|bb)/auto_callout bb /(?C1)^(?C2)(?(?C99)(?=(?C3)a(?C4))(?C5)a(?C6)a(?C7)|(?C8)b(?C9)b(?C10))(?C11)/ bb # Perl seems to have a bug with this one. /aaaaa(*COMMIT)(*PRUNE)b|a+c/ aaaaaac # Here are some that Perl treats differently because of the way it handles # backtracking verbs. /(?!a(*COMMIT)b)ac|ad/ ac ad /^(?!a(*THEN)b|ac)../ ac ad /^(?=a(*THEN)b|ac)/ ac /\A.*?(?:a|b(*THEN)c)/ ba /\A.*?(?:a|b(*THEN)c)++/ ba /\A.*?(?:a|b(*THEN)c|d)/ ba /(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/ aac /\A.*?(a|b(*THEN)c)/ ba /^(A(*THEN)B|A(*THEN)D)/ AD /(?!b(*THEN)a)bn|bnn/ bnn /(?(?=b(*SKIP)a)bn|bnn)/ bnn /(?=b(*THEN)a|)bn|bnn/ bnn # This test causes a segfault with Perl 5.18.0 /^(?=(a)){0}b(?1)/ backgammon /(?|(?f)|(?b))/I,dupnames /(?abc)(?z)\k()/IB,dupnames /a*[bcd]/B /[bcd]*a/B # A complete set of tests for auto-possessification of character types. /\D+\D \D+\d \D+\S \D+\s \D+\W \D+\w \D+. \D+\C \D+\R \D+\H \D+\h \D+\V \D+\v \D+\Z \D+\z \D+$/Bx /\d+\D \d+\d \d+\S \d+\s \d+\W \d+\w \d+. \d+\C \d+\R \d+\H \d+\h \d+\V \d+\v \d+\Z \d+\z \d+$/Bx /\S+\D \S+\d \S+\S \S+\s \S+\W \S+\w \S+. \S+\C \S+\R \S+\H \S+\h \S+\V \S+\v \S+\Z \S+\z \S+$/Bx /\s+\D \s+\d \s+\S \s+\s \s+\W \s+\w \s+. \s+\C \s+\R \s+\H \s+\h \s+\V \s+\v \s+\Z \s+\z \s+$/Bx /\W+\D \W+\d \W+\S \W+\s \W+\W \W+\w \W+. \W+\C \W+\R \W+\H \W+\h \W+\V \W+\v \W+\Z \W+\z \W+$/Bx /\w+\D \w+\d \w+\S \w+\s \w+\W \w+\w \w+. \w+\C \w+\R \w+\H \w+\h \w+\V \w+\v \w+\Z \w+\z \w+$/Bx /\C+\D \C+\d \C+\S \C+\s \C+\W \C+\w \C+. \C+\C \C+\R \C+\H \C+\h \C+\V \C+\v \C+\Z \C+\z \C+$/Bx /\R+\D \R+\d \R+\S \R+\s \R+\W \R+\w \R+. \R+\C \R+\R \R+\H \R+\h \R+\V \R+\v \R+\Z \R+\z \R+$/Bx /\H+\D \H+\d \H+\S \H+\s \H+\W \H+\w \H+. \H+\C \H+\R \H+\H \H+\h \H+\V \H+\v \H+\Z \H+\z \H+$/Bx /\h+\D \h+\d \h+\S \h+\s \h+\W \h+\w \h+. \h+\C \h+\R \h+\H \h+\h \h+\V \h+\v \h+\Z \h+\z \h+$/Bx /\V+\D \V+\d \V+\S \V+\s \V+\W \V+\w \V+. \V+\C \V+\R \V+\H \V+\h \V+\V \V+\v \V+\Z \V+\z \V+$/Bx /\v+\D \v+\d \v+\S \v+\s \v+\W \v+\w \v+. \v+\C \v+\R \v+\H \v+\h \v+\V \v+\v \v+\Z \v+\z \v+$/Bx / a+\D a+\d a+\S a+\s a+\W a+\w a+. a+\C a+\R a+\H a+\h a+\V a+\v a+\Z a+\z a+$/Bx /\n+\D \n+\d \n+\S \n+\s \n+\W \n+\w \n+. \n+\C \n+\R \n+\H \n+\h \n+\V \n+\v \n+\Z \n+\z \n+$/Bx / .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\C .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/Bx / .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\C .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/Bsx /\D+$ \d+$ \S+$ \s+$ \W+$ \w+$ \C+$ \R+$ \H+$ \h+$ \V+$ \v+$ a+$ \n+$ .+$ .+$/Bmx /(?=a+)a(a+)++a/B /a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/B /a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/B /a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/B /[ab]*/B aaaa /[ab]*?/B aaaa /[ab]?/B aaaa /[ab]??/B aaaa /[ab]+/B aaaa /[ab]+?/B aaaa /[ab]{2,3}/B aaaa /[ab]{2,3}?/B aaaa /[ab]{2,}/B aaaa /[ab]{2,}?/B aaaa /\d+\s{0,5}=\s*\S?=\w{0,4}\W*/B /[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/B /[a-z]*\s#[ \t]?\S#[a-c]*\S#[C-G]+?\d#[4-8]*\D#[4-9,]*\D#[!$]{0,5}\w#[M-Xf-l]+\W#[a-c,]?\W/B /a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/B /[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/B /[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/B /[a-c]*d/IB /[a-c]+d/IB /[a-c]?d/IB /[a-c]{4,6}d/IB /[a-c]{0,6}d/IB # End of special auto-possessive tests /^A\o{1239}B/ A\123B /^A\oB/ /^A\x{zz}B/ /^A\x{12Z/ /^A\x{/ /[ab]++/B,no_auto_possess /[^ab]*+/B,no_auto_possess /a{4}+/B,no_auto_possess /a{4}+/Bi,no_auto_possess /[a-[:digit:]]+/ /[A-[:digit:]]+/ /[a-[.xxx.]]+/ /[a-[=xxx=]]+/ /[a-[!xxx!]]+/ /[A-[!xxx!]]+/ A]]] /[a-\d]+/ /(?<0abc>xx)/ /(?&1abc)xx(?<1abc>y)/ /(?xx)/ /(?'0abc'xx)/ /(?P<0abc>xx)/ /\k<5ghj>/ /\k'5ghj'/ /\k{2fgh}/ /(?P=8yuki)/ /\g{4df}/ /(?&1abc)xx(?<1abc>y)/ /(?P>1abc)xx(?<1abc>y)/ /\g'3gh'/ /\g<5fg>/ /(?(<4gh>)abc)/ /(?('4gh')abc)/ /(?(4gh)abc)/ /(?(R&6yh)abc)/ /(((a\2)|(a*)\g<-1>))*a?/B # Test the ugly "start or end of word" compatibility syntax. /[[:<:]]red[[:>:]]/B little red riding hood a /red/ thing red is a colour put it all on red ** Failers no reduction Alfred Winifred /[a[:<:]] should give error/ /(?=ab\K)/aftertext abcd\=startchar /abcd/newline=lf,firstline xx\nxabcd # Test stack guard external calls. /(((a)))/stackguard=1 /(((a)))/stackguard=2 /(((a)))/stackguard=3 /(((((a)))))/ # End stack guard tests /^\w+(?>\s*)(?<=\w)/B /\othing/ /\o{}/ /\o{whatever}/ /\xthing/ /\x{}/ /\x{whatever}/ /A\8B/ /A\9B/ # This one is here because Perl fails to match "12" for this pattern when the $ # is present. /^(?(?=abc)\w{3}:|\d\d)$/ abc: 12 *** Failers 123 xyz # Perl gets this one wrong, giving "a" as the after text for ca and failing to # match for cd. /(?(?=ab)ab)/aftertext abxxx ca cd # This should test both paths for processing OP_RECURSE. /(?(R)a+|(?R)b)/ aaaabcde aaaabcde\=ovector=100 /a*?b*?/ ab /(*NOTEMPTY)a*?b*?/ ab ba cb /(*NOTEMPTY_ATSTART)a*?b*?/aftertext ab cdab /(?(VERSION>=10.0)yes|no)/I yesno /(?(VERSION=8)yes){3}/BI,aftertext yesno /(?(VERSION=8)yes|no){3}/I yesnononoyes ** Failers yesno /(?:(?abc)|xyz)(?(VERSION)yes|no)/I abcyes xyzno ** Failers abcno xyzyes /(?(VERSION<10)yes|no)/ /(?(VERSION>10)yes|no)/ /(?(VERSION>=10.0.0)yes|no)/ /abcd/I /abcd/I,no_start_optimize /(|ab)*?d/I abd xyd /(|ab)*?d/I,no_start_optimize abd xyd /\k*(?aa)(?bb)/match_unset_backref,dupnames aabb /(((((a)))))/parens_nest_limit=2 # Tests for pcre2_substitute() /abc/replace=XYZ 123123 123abc123 123abc123abc123 123123\=zero_terminate 123abc123\=zero_terminate 123abc123abc123\=zero_terminate /abc/g,replace=XYZ 123abc123 123abc123abc123 /abc/replace=X$$Z 123abc123 /abc/g,replace=X$$Z 123abc123abc123 /a(b)c(d)e/replace=X$1Y${2}Z "abcde" /a(b)c(d)e/replace=X$1Y${2}Z,global "abcde-abcde" /a(?b)c(?d)e/replace=X$ONE+${TWO}Z "abcde" /a(?b)c(?d)e/g,replace=X$ONE+${TWO}Z "abcde-abcde-" /abc/replace=a$++ 123abc /abc/replace=a$bad 123abc /abc/replace=a${A234567890123456789_123456789012}z 123abc /abc/replace=a${A23456789012345678901234567890123}z 123abc /abc/replace=a${bcd 123abc /abc/replace=a${b+d}z 123abc /abc/replace=[10]XYZ 123abc123 /abc/replace=[9]XYZ 123abc123 /abc/replace=xyz 1abc2\=partial_hard /abc/replace=xyz 123abc456 123abc456\=replace=pqr 123abc456abc789 123abc456abc789\=g /(?<=abc)(|def)/g,replace=<$0> 123abcxyzabcdef789abcpqr /./replace=$0 a /(.)(.)/replace=$2+$1 abc /(?.)(?.)/replace=$B+$A abc /(.)(.)/g,replace=$2$1 abcdefgh # End of substitute tests "((?=(?(?=(?(?=(?(?=()))))))))" a "(?(?=)==)(((((((((?=)))))))))" a /(a)(b)|(c)/ XcX\=ovector=2,get=1,get=2,get=3,get=4,getall /x(?=ab\K)/ xab\=get=0 xab\=copy=0 xab\=getall /(?a)|(?b)/dupnames a\=ovector=1,copy=A,get=A,get=2 a\=ovector=2,copy=A,get=A,get=2 b\=ovector=2,copy=A,get=A,get=2 /a(b)c(d)/ abc\=ph,copy=0,copy=1,getall /^abc/info /^abc/info,no_dotstar_anchor /.*\d/info,auto_callout aaa /.*\d/info,no_dotstar_anchor,auto_callout aaa /.*\d/dotall,info /.*\d/dotall,no_dotstar_anchor,info /(*NO_DOTSTAR_ANCHOR)(?s).*\d/info '^(?:(a)|b)(?(1)A|B)' aA123\=ovector=1 aA123\=ovector=2 '^(?:(?a)|b)(?()A|B)' aA123\=ovector=1 aA123\=ovector=2 '^(?)(?:(?a)|b)(?()A|B)'dupnames aA123\=ovector=1 aA123\=ovector=2 aA123\=ovector=3 '^(?:(?X)|)(?:(?a)|b)\k{AA}'dupnames aa123\=ovector=1 aa123\=ovector=2 aa123\=ovector=3 /(?(?J)(?1(111111)11|)1|1|)(?()1)/ /(?(?J)(?))(?-J)\k/ # Quantifiers are not allowed on condition assertions, but are otherwise # OK in conditions. /(?(?=0)?)+/ /(?(?=0)(?=00)?00765)/ 00765 /(?(?=0)(?=00)?00765|(?!3).56)/ 00765 456 ** Failers 356 '^(a)*+(\w)' g g\=ovector=1 '^(?:a)*+(\w)' g g\=ovector=1 # These two pattern showeds up compile-time bugs "((?2){0,1999}())?" /((?+1)(\1))/B # Callouts with string arguments /a(?C"/ /a(?C"a/ /a(?C"a"/ /a(?C"a"bcde(?C"b")xyz/ /a(?C"a)b""c")/B /ab(?C" any text with spaces ")cde/B abcde 12abcde /^a(b)c(?C1)def/ abcdef /^a(b)c(?C"AB")def/ abcdef /^a(b)c(?C1)def/ abcdef\=callout_capture /^a(b)c(?C{AB})def/B abcdef\=callout_capture /(?C`a``b`)(?C'a''b')(?C"a""b")(?C^a^^b^)(?C%a%%b%)(?C#a##b#)(?C$a$$b$)(?C{a}}b})/B,callout_info /(?:a(?C`code`)){3}/B /^(?(?C25)(?=abc)abcd|xyz)/B,callout_info abcdefg xyz123 /^(?(?C$abc$)(?=abc)abcd|xyz)/B abcdefg xyz123 /^ab(?C'first')cd(?C"second")ef/ abcdefg /(?:a(?C`code`)){3}X/ aaaXY # Binary zero in callout string # a ( ? C ' x z ' ) b / 61 28 3f 43 27 78 00 7a 27 29 62/hex,callout_info abcdefgh /(?(?!)^)/ /(?(?!)a|b)/ bbb ** Failers aaa # JIT gives a different error message for the infinite recursion "(*NO_JIT)((?2)+)((?1)){" abcd{ # Perl fails to diagnose the absence of an assertion "(?(?.*!.*)?)" # End of testinput2