1# This set of tests is for features that are compatible with all versions of 2# Perl >= 5.10, in non-UTF mode. It should run clean for the 8-bit, 16-bit, and 3# 32-bit PCRE libraries, and also using the perltest.pl script. 4 5#forbid_utf 6#newline_default lf any anycrlf 7#perltest 8 9/the quick brown fox/ 10 the quick brown fox 11 What do you know about the quick brown fox? 12\= Expect no match 13 The quick brown FOX 14 What do you know about THE QUICK BROWN FOX? 15 16/The quick brown fox/i 17 the quick brown fox 18 The quick brown FOX 19 What do you know about the quick brown fox? 20 What do you know about THE QUICK BROWN FOX? 21 22/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/ 23 abcd\t\n\r\f\a\e9;\$\\?caxyz 24 25/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/ 26 abxyzpqrrrabbxyyyypqAzz 27 abxyzpqrrrabbxyyyypqAzz 28 aabxyzpqrrrabbxyyyypqAzz 29 aaabxyzpqrrrabbxyyyypqAzz 30 aaaabxyzpqrrrabbxyyyypqAzz 31 abcxyzpqrrrabbxyyyypqAzz 32 aabcxyzpqrrrabbxyyyypqAzz 33 aaabcxyzpqrrrabbxyyyypAzz 34 aaabcxyzpqrrrabbxyyyypqAzz 35 aaabcxyzpqrrrabbxyyyypqqAzz 36 aaabcxyzpqrrrabbxyyyypqqqAzz 37 aaabcxyzpqrrrabbxyyyypqqqqAzz 38 aaabcxyzpqrrrabbxyyyypqqqqqAzz 39 aaabcxyzpqrrrabbxyyyypqqqqqqAzz 40 aaaabcxyzpqrrrabbxyyyypqAzz 41 abxyzzpqrrrabbxyyyypqAzz 42 aabxyzzzpqrrrabbxyyyypqAzz 43 aaabxyzzzzpqrrrabbxyyyypqAzz 44 aaaabxyzzzzpqrrrabbxyyyypqAzz 45 abcxyzzpqrrrabbxyyyypqAzz 46 aabcxyzzzpqrrrabbxyyyypqAzz 47 aaabcxyzzzzpqrrrabbxyyyypqAzz 48 aaaabcxyzzzzpqrrrabbxyyyypqAzz 49 aaaabcxyzzzzpqrrrabbbxyyyypqAzz 50 aaaabcxyzzzzpqrrrabbbxyyyyypqAzz 51 aaabcxyzpqrrrabbxyyyypABzz 52 aaabcxyzpqrrrabbxyyyypABBzz 53 >>>aaabxyzpqrrrabbxyyyypqAzz 54 >aaaabxyzpqrrrabbxyyyypqAzz 55 >>>>abcxyzpqrrrabbxyyyypqAzz 56\= Expect no match 57 abxyzpqrrabbxyyyypqAzz 58 abxyzpqrrrrabbxyyyypqAzz 59 abxyzpqrrrabxyyyypqAzz 60 aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz 61 aaaabcxyzzzzpqrrrabbbxyyypqAzz 62 aaabcxyzpqrrrabbxyyyypqqqqqqqAzz 63 64/^(abc){1,2}zz/ 65 abczz 66 abcabczz 67\= Expect no match 68 zz 69 abcabcabczz 70 >>abczz 71 72/^(b+?|a){1,2}?c/ 73 bc 74 bbc 75 bbbc 76 bac 77 bbac 78 aac 79 abbbbbbbbbbbc 80 bbbbbbbbbbbac 81\= Expect no match 82 aaac 83 abbbbbbbbbbbac 84 85/^(b+|a){1,2}c/ 86 bc 87 bbc 88 bbbc 89 bac 90 bbac 91 aac 92 abbbbbbbbbbbc 93 bbbbbbbbbbbac 94\= Expect no match 95 aaac 96 abbbbbbbbbbbac 97 98/^(ba|b*){1,2}?bc/ 99 babc 100 bbabc 101 bababc 102\= Expect no match 103 bababbc 104 babababc 105 106/^\ca\cA\c[;\c:/ 107 \x01\x01\e;z 108 109/^[ab\]cde]/ 110 athing 111 bthing 112 ]thing 113 cthing 114 dthing 115 ething 116\= Expect no match 117 fthing 118 [thing 119 \\thing 120 121/^[]cde]/ 122 ]thing 123 cthing 124 dthing 125 ething 126\= Expect no match 127 athing 128 fthing 129 130/^[^ab\]cde]/ 131 fthing 132 [thing 133 \\thing 134\= Expect no match 135 athing 136 bthing 137 ]thing 138 cthing 139 dthing 140 ething 141 142/^[^]cde]/ 143 athing 144 fthing 145\= Expect no match 146 ]thing 147 cthing 148 dthing 149 ething 150 151/^\�/ 152 � 153 154/^�/ 155 � 156 157/^[0-9]+$/ 158 0 159 1 160 2 161 3 162 4 163 5 164 6 165 7 166 8 167 9 168 10 169 100 170\= Expect no match 171 abc 172 173/^.*nter/ 174 enter 175 inter 176 uponter 177 178/^xxx[0-9]+$/ 179 xxx0 180 xxx1234 181\= Expect no match 182 xxx 183 184/^.+[0-9][0-9][0-9]$/ 185 x123 186 x1234 187 xx123 188 123456 189\= Expect no match 190 123 191 192/^.+?[0-9][0-9][0-9]$/ 193 x123 194 x1234 195 xx123 196 123456 197\= Expect no match 198 123 199 200/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/ 201 abc!pqr=apquxz.ixr.zzz.ac.uk 202\= Expect no match 203 !pqr=apquxz.ixr.zzz.ac.uk 204 abc!=apquxz.ixr.zzz.ac.uk 205 abc!pqr=apquxz:ixr.zzz.ac.uk 206 abc!pqr=apquxz.ixr.zzz.ac.ukk 207 208/:/ 209 Well, we need a colon: somewhere 210\= Expect no match 211 Fail without a colon 212 213/([\da-f:]+)$/i 214 0abc 215 abc 216 fed 217 E 218 :: 219 5f03:12C0::932e 220 fed def 221 Any old stuff 222\= Expect no match 223 0zzz 224 gzzz 225 fed\x20 226 Any old rubbish 227 228/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ 229 .1.2.3 230 A.12.123.0 231\= Expect no match 232 .1.2.3333 233 1.2.3 234 1234.2.3 235 236/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ 237 1 IN SOA non-sp1 non-sp2( 238 1 IN SOA non-sp1 non-sp2 ( 239\= Expect no match 240 1IN SOA non-sp1 non-sp2( 241 242/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/ 243 a. 244 Z. 245 2. 246 ab-c.pq-r. 247 sxk.zzz.ac.uk. 248 x-.y-. 249\= Expect no match 250 -abc.peq. 251 252/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/ 253 *.a 254 *.b0-a 255 *.c3-b.c 256 *.c-a.b-c 257\= Expect no match 258 *.0 259 *.a- 260 *.a-b.c- 261 *.c-a.0-c 262 263/^(?=ab(de))(abd)(e)/ 264 abde 265 266/^(?!(ab)de|x)(abd)(f)/ 267 abdf 268 269/^(?=(ab(cd)))(ab)/ 270 abcd 271 272/^[\da-f](\.[\da-f])*$/i 273 a.b.c.d 274 A.B.C.D 275 a.b.c.1.2.3.C 276 277/^\".*\"\s*(;.*)?$/ 278 \"1234\" 279 \"abcd\" ; 280 \"\" ; rhubarb 281\= Expect no match 282 \"1234\" : things 283 284/^$/ 285 \ 286\= Expect no match 287 A non-empty line 288 289/ ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x 290 ab c 291\= Expect no match 292 abc 293 ab cde 294 295/(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/ 296 ab c 297\= Expect no match 298 abc 299 ab cde 300 301/^ a\ b[c ]d $/x 302 a bcd 303 a b d 304\= Expect no match 305 abcd 306 ab d 307 308/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/ 309 abcdefhijklm 310 311/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/ 312 abcdefhijklm 313 314/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/ 315 a+ Z0+\x08\n\x1d\x12 316 317/^[.^$|()*+?{,}]+/ 318 .^\$(*+)|{?,?} 319 320/^a*\w/ 321 z 322 az 323 aaaz 324 a 325 aa 326 aaaa 327 a+ 328 aa+ 329 330/^a*?\w/ 331 z 332 az 333 aaaz 334 a 335 aa 336 aaaa 337 a+ 338 aa+ 339 340/^a+\w/ 341 az 342 aaaz 343 aa 344 aaaa 345 aa+ 346 347/^a+?\w/ 348 az 349 aaaz 350 aa 351 aaaa 352 aa+ 353 354/^\d{8}\w{2,}/ 355 1234567890 356 12345678ab 357 12345678__ 358\= Expect no match 359 1234567 360 361/^[aeiou\d]{4,5}$/ 362 uoie 363 1234 364 12345 365 aaaaa 366\= Expect no match 367 123456 368 369/^[aeiou\d]{4,5}?/ 370 uoie 371 1234 372 12345 373 aaaaa 374 123456 375 376/\A(abc|def)=(\1){2,3}\Z/ 377 abc=abcabc 378 def=defdefdef 379\= Expect no match 380 abc=defdef 381 382/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ 383 abcdefghijkcda2 384 abcdefghijkkkkcda2 385 386/(cat(a(ract|tonic)|erpillar)) \1()2(3)/ 387 cataract cataract23 388 catatonic catatonic23 389 caterpillar caterpillar23 390 391 392/^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]/ 393 From abcd Mon Sep 01 12:33:02 1997 394 395/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ 396 From abcd Mon Sep 01 12:33:02 1997 397 From abcd Mon Sep 1 12:33:02 1997 398\= Expect no match 399 From abcd Sep 01 12:33:02 1997 400 401/^12.34/s 402 12\n34 403 12\r34 404 405/\w+(?=\t)/ 406 the quick brown\t fox 407 408/foo(?!bar)(.*)/ 409 foobar is foolish see? 410 411/(?:(?!foo)...|^.{0,2})bar(.*)/ 412 foobar crowbar etc 413 barrel 414 2barrel 415 A barrel 416 417/^(\D*)(?=\d)(?!123)/ 418 abc456 419\= Expect no match 420 abc123 421 422/^1234(?# test newlines 423 inside)/ 424 1234 425 426/^1234 #comment in extended re 427 /x 428 1234 429 430/#rhubarb 431 abcd/x 432 abcd 433 434/^abcd#rhubarb/x 435 abcd 436 437/^(a)\1{2,3}(.)/ 438 aaab 439 aaaab 440 aaaaab 441 aaaaaab 442 443/(?!^)abc/ 444 the abc 445\= Expect no match 446 abc 447 448/(?=^)abc/ 449 abc 450\= Expect no match 451 the abc 452 453/^[ab]{1,3}(ab*|b)/ 454 aabbbbb 455 456/^[ab]{1,3}?(ab*|b)/ 457 aabbbbb 458 459/^[ab]{1,3}?(ab*?|b)/ 460 aabbbbb 461 462/^[ab]{1,3}(ab*?|b)/ 463 aabbbbb 464 465/ (?: [\040\t] | \( 466(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 467\) )* # optional leading comment 468(?: (?: 469[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 470(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 471| 472" (?: # opening quote... 473[^\\\x80-\xff\n\015"] # Anything except backslash and quote 474| # or 475\\ [^\x80-\xff] # Escaped something (something != CR) 476)* " # closing quote 477) # initial word 478(?: (?: [\040\t] | \( 479(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 480\) )* \. (?: [\040\t] | \( 481(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 482\) )* (?: 483[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 484(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 485| 486" (?: # opening quote... 487[^\\\x80-\xff\n\015"] # Anything except backslash and quote 488| # or 489\\ [^\x80-\xff] # Escaped something (something != CR) 490)* " # closing quote 491) )* # further okay, if led by a period 492(?: [\040\t] | \( 493(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 494\) )* @ (?: [\040\t] | \( 495(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 496\) )* (?: 497[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 498(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 499| \[ # [ 500(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 501\] # ] 502) # initial subdomain 503(?: # 504(?: [\040\t] | \( 505(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 506\) )* \. # if led by a period... 507(?: [\040\t] | \( 508(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 509\) )* (?: 510[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 511(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 512| \[ # [ 513(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 514\] # ] 515) # ...further okay 516)* 517# address 518| # or 519(?: 520[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 521(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 522| 523" (?: # opening quote... 524[^\\\x80-\xff\n\015"] # Anything except backslash and quote 525| # or 526\\ [^\x80-\xff] # Escaped something (something != CR) 527)* " # closing quote 528) # one word, optionally followed by.... 529(?: 530[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or... 531\( 532(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 533\) | # comments, or... 534 535" (?: # opening quote... 536[^\\\x80-\xff\n\015"] # Anything except backslash and quote 537| # or 538\\ [^\x80-\xff] # Escaped something (something != CR) 539)* " # closing quote 540# quoted strings 541)* 542< (?: [\040\t] | \( 543(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 544\) )* # leading < 545(?: @ (?: [\040\t] | \( 546(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 547\) )* (?: 548[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 549(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 550| \[ # [ 551(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 552\] # ] 553) # initial subdomain 554(?: # 555(?: [\040\t] | \( 556(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 557\) )* \. # if led by a period... 558(?: [\040\t] | \( 559(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 560\) )* (?: 561[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 562(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 563| \[ # [ 564(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 565\] # ] 566) # ...further okay 567)* 568 569(?: (?: [\040\t] | \( 570(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 571\) )* , (?: [\040\t] | \( 572(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 573\) )* @ (?: [\040\t] | \( 574(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 575\) )* (?: 576[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 577(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 578| \[ # [ 579(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 580\] # ] 581) # initial subdomain 582(?: # 583(?: [\040\t] | \( 584(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 585\) )* \. # if led by a period... 586(?: [\040\t] | \( 587(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 588\) )* (?: 589[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 590(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 591| \[ # [ 592(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 593\] # ] 594) # ...further okay 595)* 596)* # further okay, if led by comma 597: # closing colon 598(?: [\040\t] | \( 599(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 600\) )* )? # optional route 601(?: 602[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 603(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 604| 605" (?: # opening quote... 606[^\\\x80-\xff\n\015"] # Anything except backslash and quote 607| # or 608\\ [^\x80-\xff] # Escaped something (something != CR) 609)* " # closing quote 610) # initial word 611(?: (?: [\040\t] | \( 612(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 613\) )* \. (?: [\040\t] | \( 614(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 615\) )* (?: 616[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 617(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 618| 619" (?: # opening quote... 620[^\\\x80-\xff\n\015"] # Anything except backslash and quote 621| # or 622\\ [^\x80-\xff] # Escaped something (something != CR) 623)* " # closing quote 624) )* # further okay, if led by a period 625(?: [\040\t] | \( 626(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 627\) )* @ (?: [\040\t] | \( 628(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 629\) )* (?: 630[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 631(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 632| \[ # [ 633(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 634\] # ] 635) # initial subdomain 636(?: # 637(?: [\040\t] | \( 638(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 639\) )* \. # if led by a period... 640(?: [\040\t] | \( 641(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 642\) )* (?: 643[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 644(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 645| \[ # [ 646(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 647\] # ] 648) # ...further okay 649)* 650# address spec 651(?: [\040\t] | \( 652(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 653\) )* > # trailing > 654# name and address 655) (?: [\040\t] | \( 656(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* 657\) )* # optional trailing comment 658/x 659 Alan Other <user\@dom.ain> 660 <user\@dom.ain> 661 user\@dom.ain 662 \"A. Other\" <user.1234\@dom.ain> (a comment) 663 A. Other <user.1234\@dom.ain> (a comment) 664 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay 665 A missing angle <user\@some.where 666\= Expect no match 667 The quick brown fox 668 669/[\040\t]* # Nab whitespace. 670(?: 671\( # ( 672[^\\\x80-\xff\n\015()] * # normal* 673(?: # ( 674(?: \\ [^\x80-\xff] | 675\( # ( 676[^\\\x80-\xff\n\015()] * # normal* 677(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 678\) # ) 679) # special 680[^\\\x80-\xff\n\015()] * # normal* 681)* # )* 682\) # ) 683[\040\t]* )* # If comment found, allow more spaces. 684# optional leading comment 685(?: 686(?: 687[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 688(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 689# Atom 690| # or 691" # " 692[^\\\x80-\xff\n\015"] * # normal 693(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 694" # " 695# Quoted string 696) 697[\040\t]* # Nab whitespace. 698(?: 699\( # ( 700[^\\\x80-\xff\n\015()] * # normal* 701(?: # ( 702(?: \\ [^\x80-\xff] | 703\( # ( 704[^\\\x80-\xff\n\015()] * # normal* 705(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 706\) # ) 707) # special 708[^\\\x80-\xff\n\015()] * # normal* 709)* # )* 710\) # ) 711[\040\t]* )* # If comment found, allow more spaces. 712(?: 713\. 714[\040\t]* # Nab whitespace. 715(?: 716\( # ( 717[^\\\x80-\xff\n\015()] * # normal* 718(?: # ( 719(?: \\ [^\x80-\xff] | 720\( # ( 721[^\\\x80-\xff\n\015()] * # normal* 722(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 723\) # ) 724) # special 725[^\\\x80-\xff\n\015()] * # normal* 726)* # )* 727\) # ) 728[\040\t]* )* # If comment found, allow more spaces. 729(?: 730[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 731(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 732# Atom 733| # or 734" # " 735[^\\\x80-\xff\n\015"] * # normal 736(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 737" # " 738# Quoted string 739) 740[\040\t]* # Nab whitespace. 741(?: 742\( # ( 743[^\\\x80-\xff\n\015()] * # normal* 744(?: # ( 745(?: \\ [^\x80-\xff] | 746\( # ( 747[^\\\x80-\xff\n\015()] * # normal* 748(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 749\) # ) 750) # special 751[^\\\x80-\xff\n\015()] * # normal* 752)* # )* 753\) # ) 754[\040\t]* )* # If comment found, allow more spaces. 755# additional words 756)* 757@ 758[\040\t]* # Nab whitespace. 759(?: 760\( # ( 761[^\\\x80-\xff\n\015()] * # normal* 762(?: # ( 763(?: \\ [^\x80-\xff] | 764\( # ( 765[^\\\x80-\xff\n\015()] * # normal* 766(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 767\) # ) 768) # special 769[^\\\x80-\xff\n\015()] * # normal* 770)* # )* 771\) # ) 772[\040\t]* )* # If comment found, allow more spaces. 773(?: 774[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 775(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 776| 777\[ # [ 778(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 779\] # ] 780) 781[\040\t]* # Nab whitespace. 782(?: 783\( # ( 784[^\\\x80-\xff\n\015()] * # normal* 785(?: # ( 786(?: \\ [^\x80-\xff] | 787\( # ( 788[^\\\x80-\xff\n\015()] * # normal* 789(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 790\) # ) 791) # special 792[^\\\x80-\xff\n\015()] * # normal* 793)* # )* 794\) # ) 795[\040\t]* )* # If comment found, allow more spaces. 796# optional trailing comments 797(?: 798\. 799[\040\t]* # Nab whitespace. 800(?: 801\( # ( 802[^\\\x80-\xff\n\015()] * # normal* 803(?: # ( 804(?: \\ [^\x80-\xff] | 805\( # ( 806[^\\\x80-\xff\n\015()] * # normal* 807(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 808\) # ) 809) # special 810[^\\\x80-\xff\n\015()] * # normal* 811)* # )* 812\) # ) 813[\040\t]* )* # If comment found, allow more spaces. 814(?: 815[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 816(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 817| 818\[ # [ 819(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 820\] # ] 821) 822[\040\t]* # Nab whitespace. 823(?: 824\( # ( 825[^\\\x80-\xff\n\015()] * # normal* 826(?: # ( 827(?: \\ [^\x80-\xff] | 828\( # ( 829[^\\\x80-\xff\n\015()] * # normal* 830(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 831\) # ) 832) # special 833[^\\\x80-\xff\n\015()] * # normal* 834)* # )* 835\) # ) 836[\040\t]* )* # If comment found, allow more spaces. 837# optional trailing comments 838)* 839# address 840| # or 841(?: 842[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 843(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 844# Atom 845| # or 846" # " 847[^\\\x80-\xff\n\015"] * # normal 848(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 849" # " 850# Quoted string 851) 852# leading word 853[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces 854(?: 855(?: 856\( # ( 857[^\\\x80-\xff\n\015()] * # normal* 858(?: # ( 859(?: \\ [^\x80-\xff] | 860\( # ( 861[^\\\x80-\xff\n\015()] * # normal* 862(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 863\) # ) 864) # special 865[^\\\x80-\xff\n\015()] * # normal* 866)* # )* 867\) # ) 868| 869" # " 870[^\\\x80-\xff\n\015"] * # normal 871(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 872" # " 873) # "special" comment or quoted string 874[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal" 875)* 876< 877[\040\t]* # Nab whitespace. 878(?: 879\( # ( 880[^\\\x80-\xff\n\015()] * # normal* 881(?: # ( 882(?: \\ [^\x80-\xff] | 883\( # ( 884[^\\\x80-\xff\n\015()] * # normal* 885(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 886\) # ) 887) # special 888[^\\\x80-\xff\n\015()] * # normal* 889)* # )* 890\) # ) 891[\040\t]* )* # If comment found, allow more spaces. 892# < 893(?: 894@ 895[\040\t]* # Nab whitespace. 896(?: 897\( # ( 898[^\\\x80-\xff\n\015()] * # normal* 899(?: # ( 900(?: \\ [^\x80-\xff] | 901\( # ( 902[^\\\x80-\xff\n\015()] * # normal* 903(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 904\) # ) 905) # special 906[^\\\x80-\xff\n\015()] * # normal* 907)* # )* 908\) # ) 909[\040\t]* )* # If comment found, allow more spaces. 910(?: 911[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 912(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 913| 914\[ # [ 915(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 916\] # ] 917) 918[\040\t]* # Nab whitespace. 919(?: 920\( # ( 921[^\\\x80-\xff\n\015()] * # normal* 922(?: # ( 923(?: \\ [^\x80-\xff] | 924\( # ( 925[^\\\x80-\xff\n\015()] * # normal* 926(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 927\) # ) 928) # special 929[^\\\x80-\xff\n\015()] * # normal* 930)* # )* 931\) # ) 932[\040\t]* )* # If comment found, allow more spaces. 933# optional trailing comments 934(?: 935\. 936[\040\t]* # Nab whitespace. 937(?: 938\( # ( 939[^\\\x80-\xff\n\015()] * # normal* 940(?: # ( 941(?: \\ [^\x80-\xff] | 942\( # ( 943[^\\\x80-\xff\n\015()] * # normal* 944(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 945\) # ) 946) # special 947[^\\\x80-\xff\n\015()] * # normal* 948)* # )* 949\) # ) 950[\040\t]* )* # If comment found, allow more spaces. 951(?: 952[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 953(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 954| 955\[ # [ 956(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 957\] # ] 958) 959[\040\t]* # Nab whitespace. 960(?: 961\( # ( 962[^\\\x80-\xff\n\015()] * # normal* 963(?: # ( 964(?: \\ [^\x80-\xff] | 965\( # ( 966[^\\\x80-\xff\n\015()] * # normal* 967(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 968\) # ) 969) # special 970[^\\\x80-\xff\n\015()] * # normal* 971)* # )* 972\) # ) 973[\040\t]* )* # If comment found, allow more spaces. 974# optional trailing comments 975)* 976(?: , 977[\040\t]* # Nab whitespace. 978(?: 979\( # ( 980[^\\\x80-\xff\n\015()] * # normal* 981(?: # ( 982(?: \\ [^\x80-\xff] | 983\( # ( 984[^\\\x80-\xff\n\015()] * # normal* 985(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 986\) # ) 987) # special 988[^\\\x80-\xff\n\015()] * # normal* 989)* # )* 990\) # ) 991[\040\t]* )* # If comment found, allow more spaces. 992@ 993[\040\t]* # Nab whitespace. 994(?: 995\( # ( 996[^\\\x80-\xff\n\015()] * # normal* 997(?: # ( 998(?: \\ [^\x80-\xff] | 999\( # ( 1000[^\\\x80-\xff\n\015()] * # normal* 1001(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1002\) # ) 1003) # special 1004[^\\\x80-\xff\n\015()] * # normal* 1005)* # )* 1006\) # ) 1007[\040\t]* )* # If comment found, allow more spaces. 1008(?: 1009[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1010(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1011| 1012\[ # [ 1013(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1014\] # ] 1015) 1016[\040\t]* # Nab whitespace. 1017(?: 1018\( # ( 1019[^\\\x80-\xff\n\015()] * # normal* 1020(?: # ( 1021(?: \\ [^\x80-\xff] | 1022\( # ( 1023[^\\\x80-\xff\n\015()] * # normal* 1024(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1025\) # ) 1026) # special 1027[^\\\x80-\xff\n\015()] * # normal* 1028)* # )* 1029\) # ) 1030[\040\t]* )* # If comment found, allow more spaces. 1031# optional trailing comments 1032(?: 1033\. 1034[\040\t]* # Nab whitespace. 1035(?: 1036\( # ( 1037[^\\\x80-\xff\n\015()] * # normal* 1038(?: # ( 1039(?: \\ [^\x80-\xff] | 1040\( # ( 1041[^\\\x80-\xff\n\015()] * # normal* 1042(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1043\) # ) 1044) # special 1045[^\\\x80-\xff\n\015()] * # normal* 1046)* # )* 1047\) # ) 1048[\040\t]* )* # If comment found, allow more spaces. 1049(?: 1050[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1051(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1052| 1053\[ # [ 1054(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1055\] # ] 1056) 1057[\040\t]* # Nab whitespace. 1058(?: 1059\( # ( 1060[^\\\x80-\xff\n\015()] * # normal* 1061(?: # ( 1062(?: \\ [^\x80-\xff] | 1063\( # ( 1064[^\\\x80-\xff\n\015()] * # normal* 1065(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1066\) # ) 1067) # special 1068[^\\\x80-\xff\n\015()] * # normal* 1069)* # )* 1070\) # ) 1071[\040\t]* )* # If comment found, allow more spaces. 1072# optional trailing comments 1073)* 1074)* # additional domains 1075: 1076[\040\t]* # Nab whitespace. 1077(?: 1078\( # ( 1079[^\\\x80-\xff\n\015()] * # normal* 1080(?: # ( 1081(?: \\ [^\x80-\xff] | 1082\( # ( 1083[^\\\x80-\xff\n\015()] * # normal* 1084(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1085\) # ) 1086) # special 1087[^\\\x80-\xff\n\015()] * # normal* 1088)* # )* 1089\) # ) 1090[\040\t]* )* # If comment found, allow more spaces. 1091# optional trailing comments 1092)? # optional route 1093(?: 1094[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1095(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1096# Atom 1097| # or 1098" # " 1099[^\\\x80-\xff\n\015"] * # normal 1100(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1101" # " 1102# Quoted string 1103) 1104[\040\t]* # Nab whitespace. 1105(?: 1106\( # ( 1107[^\\\x80-\xff\n\015()] * # normal* 1108(?: # ( 1109(?: \\ [^\x80-\xff] | 1110\( # ( 1111[^\\\x80-\xff\n\015()] * # normal* 1112(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1113\) # ) 1114) # special 1115[^\\\x80-\xff\n\015()] * # normal* 1116)* # )* 1117\) # ) 1118[\040\t]* )* # If comment found, allow more spaces. 1119(?: 1120\. 1121[\040\t]* # Nab whitespace. 1122(?: 1123\( # ( 1124[^\\\x80-\xff\n\015()] * # normal* 1125(?: # ( 1126(?: \\ [^\x80-\xff] | 1127\( # ( 1128[^\\\x80-\xff\n\015()] * # normal* 1129(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1130\) # ) 1131) # special 1132[^\\\x80-\xff\n\015()] * # normal* 1133)* # )* 1134\) # ) 1135[\040\t]* )* # If comment found, allow more spaces. 1136(?: 1137[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1138(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1139# Atom 1140| # or 1141" # " 1142[^\\\x80-\xff\n\015"] * # normal 1143(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )* 1144" # " 1145# Quoted string 1146) 1147[\040\t]* # Nab whitespace. 1148(?: 1149\( # ( 1150[^\\\x80-\xff\n\015()] * # normal* 1151(?: # ( 1152(?: \\ [^\x80-\xff] | 1153\( # ( 1154[^\\\x80-\xff\n\015()] * # normal* 1155(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1156\) # ) 1157) # special 1158[^\\\x80-\xff\n\015()] * # normal* 1159)* # )* 1160\) # ) 1161[\040\t]* )* # If comment found, allow more spaces. 1162# additional words 1163)* 1164@ 1165[\040\t]* # Nab whitespace. 1166(?: 1167\( # ( 1168[^\\\x80-\xff\n\015()] * # normal* 1169(?: # ( 1170(?: \\ [^\x80-\xff] | 1171\( # ( 1172[^\\\x80-\xff\n\015()] * # normal* 1173(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1174\) # ) 1175) # special 1176[^\\\x80-\xff\n\015()] * # normal* 1177)* # )* 1178\) # ) 1179[\040\t]* )* # If comment found, allow more spaces. 1180(?: 1181[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1182(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1183| 1184\[ # [ 1185(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1186\] # ] 1187) 1188[\040\t]* # Nab whitespace. 1189(?: 1190\( # ( 1191[^\\\x80-\xff\n\015()] * # normal* 1192(?: # ( 1193(?: \\ [^\x80-\xff] | 1194\( # ( 1195[^\\\x80-\xff\n\015()] * # normal* 1196(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1197\) # ) 1198) # special 1199[^\\\x80-\xff\n\015()] * # normal* 1200)* # )* 1201\) # ) 1202[\040\t]* )* # If comment found, allow more spaces. 1203# optional trailing comments 1204(?: 1205\. 1206[\040\t]* # Nab whitespace. 1207(?: 1208\( # ( 1209[^\\\x80-\xff\n\015()] * # normal* 1210(?: # ( 1211(?: \\ [^\x80-\xff] | 1212\( # ( 1213[^\\\x80-\xff\n\015()] * # normal* 1214(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1215\) # ) 1216) # special 1217[^\\\x80-\xff\n\015()] * # normal* 1218)* # )* 1219\) # ) 1220[\040\t]* )* # If comment found, allow more spaces. 1221(?: 1222[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters... 1223(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom 1224| 1225\[ # [ 1226(?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff 1227\] # ] 1228) 1229[\040\t]* # Nab whitespace. 1230(?: 1231\( # ( 1232[^\\\x80-\xff\n\015()] * # normal* 1233(?: # ( 1234(?: \\ [^\x80-\xff] | 1235\( # ( 1236[^\\\x80-\xff\n\015()] * # normal* 1237(?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)* 1238\) # ) 1239) # special 1240[^\\\x80-\xff\n\015()] * # normal* 1241)* # )* 1242\) # ) 1243[\040\t]* )* # If comment found, allow more spaces. 1244# optional trailing comments 1245)* 1246# address spec 1247> # > 1248# name and address 1249) 1250/x 1251 Alan Other <user\@dom.ain> 1252 <user\@dom.ain> 1253 user\@dom.ain 1254 \"A. Other\" <user.1234\@dom.ain> (a comment) 1255 A. Other <user.1234\@dom.ain> (a comment) 1256 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay 1257 A missing angle <user\@some.where 1258\= Expect no match 1259 The quick brown fox 1260 1261/abc\0def\00pqr\000xyz\0000AB/ 1262 abc\0def\00pqr\000xyz\0000AB 1263 abc456 abc\0def\00pqr\000xyz\0000ABCDE 1264 1265/abc\x0def\x00pqr\x000xyz\x0000AB/ 1266 abc\x0def\x00pqr\x000xyz\x0000AB 1267 abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE 1268 1269/^[\000-\037]/ 1270 \0A 1271 \01B 1272 \037C 1273 1274/\0*/ 1275 \0\0\0\0 1276 1277/A\x0{2,3}Z/ 1278 The A\x0\x0Z 1279 An A\0\x0\0Z 1280\= Expect no match 1281 A\0Z 1282 A\0\x0\0\x0Z 1283 1284/^(cow|)\1(bell)/ 1285 cowcowbell 1286 bell 1287\= Expect no match 1288 cowbell 1289 1290/^\s/ 1291 \040abc 1292 \x0cabc 1293 \nabc 1294 \rabc 1295 \tabc 1296\= Expect no match 1297 abc 1298 1299/^a b 1300 c/x 1301 abc 1302 1303/^(a|)\1*b/ 1304 ab 1305 aaaab 1306 b 1307\= Expect no match 1308 acb 1309 1310/^(a|)\1+b/ 1311 aab 1312 aaaab 1313 b 1314\= Expect no match 1315 ab 1316 1317/^(a|)\1?b/ 1318 ab 1319 aab 1320 b 1321\= Expect no match 1322 acb 1323 1324/^(a|)\1{2}b/ 1325 aaab 1326 b 1327\= Expect no match 1328 ab 1329 aab 1330 aaaab 1331 1332/^(a|)\1{2,3}b/ 1333 aaab 1334 aaaab 1335 b 1336\= Expect no match 1337 ab 1338 aab 1339 aaaaab 1340 1341/ab{1,3}bc/ 1342 abbbbc 1343 abbbc 1344 abbc 1345\= Expect no match 1346 abc 1347 abbbbbc 1348 1349/([^.]*)\.([^:]*):[T ]+(.*)/ 1350 track1.title:TBlah blah blah 1351 1352/([^.]*)\.([^:]*):[T ]+(.*)/i 1353 track1.title:TBlah blah blah 1354 1355/([^.]*)\.([^:]*):[t ]+(.*)/i 1356 track1.title:TBlah blah blah 1357 1358/^[W-c]+$/ 1359 WXY_^abc 1360\= Expect no match 1361 wxy 1362 1363/^[W-c]+$/i 1364 WXY_^abc 1365 wxy_^ABC 1366 1367/^[\x3f-\x5F]+$/i 1368 WXY_^abc 1369 wxy_^ABC 1370 1371/^abc$/m 1372 abc 1373 qqq\nabc 1374 abc\nzzz 1375 qqq\nabc\nzzz 1376 1377/^abc$/ 1378 abc 1379\= Expect no match 1380 qqq\nabc 1381 abc\nzzz 1382 qqq\nabc\nzzz 1383 1384/\Aabc\Z/m 1385 abc 1386 abc\n 1387\= Expect no match 1388 qqq\nabc 1389 abc\nzzz 1390 qqq\nabc\nzzz 1391 1392/\A(.)*\Z/s 1393 abc\ndef 1394 1395/\A(.)*\Z/m 1396\= Expect no match 1397 abc\ndef 1398 1399/(?:b)|(?::+)/ 1400 b::c 1401 c::b 1402 1403/[-az]+/ 1404 az- 1405\= Expect no match 1406 b 1407 1408/[az-]+/ 1409 za- 1410\= Expect no match 1411 b 1412 1413/[a\-z]+/ 1414 a-z 1415\= Expect no match 1416 b 1417 1418/[a-z]+/ 1419 abcdxyz 1420 1421/[\d-]+/ 1422 12-34 1423\= Expect no match 1424 aaa 1425 1426/\x5c/ 1427 \\ 1428 1429/\x20Z/ 1430 the Zoo 1431\= Expect no match 1432 Zulu 1433 1434/(abc)\1/i 1435 abcabc 1436 ABCabc 1437 abcABC 1438 1439/abc$/ 1440 abc 1441 abc\n 1442\= Expect no match 1443 abc\ndef 1444 1445/(abc)\123/ 1446 abc\x53 1447 1448/(abc)\223/ 1449 abc\x93 1450 1451/(abc)\323/ 1452 abc\xd3 1453 1454/(abc)\100/ 1455 abc\x40 1456 abc\100 1457 1458/(abc)\1000/ 1459 abc\x400 1460 abc\x40\x30 1461 abc\1000 1462 abc\100\x30 1463 abc\100\060 1464 abc\100\60 1465 1466/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/ 1467 ABCDEFGHIHI 1468 1469/^[A\8B\9C]+$/ 1470 A8B9C 1471\= Expect no match 1472 A8B9C\x00 1473 1474/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/ 1475 abcdefghijkllS 1476 1477/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/ 1478 abcdefghijk\12S 1479 1480/a{0}bc/ 1481 bc 1482 1483/(a|(bc)){0,0}?xyz/ 1484 xyz 1485 1486/abc[\10]de/ 1487 abc\010de 1488 1489/abc[\1]de/ 1490 abc\1de 1491 1492/(abc)[\1]de/ 1493 abc\1de 1494 1495/(?s)a.b/ 1496 a\nb 1497 1498/^([^a])([^\b])([^c]*)([^d]{3,4})/ 1499 baNOTccccd 1500 baNOTcccd 1501 baNOTccd 1502 bacccd 1503\= Expect no match 1504 anything 1505 b\bc 1506 baccd 1507 1508/[^a]/ 1509 Abc 1510 1511/[^a]/i 1512 Abc 1513 1514/[^a]+/ 1515 AAAaAbc 1516 1517/[^a]+/i 1518 AAAaAbc 1519 1520/[^a]+/ 1521 bbb\nccc 1522 1523/[^k]$/ 1524 abc 1525\= Expect no match 1526 abk 1527 1528/[^k]{2,3}$/ 1529 abc 1530 kbc 1531 kabc 1532\= Expect no match 1533 abk 1534 akb 1535 akk 1536 1537/^\d{8,}\@.+[^k]$/ 1538 12345678\@a.b.c.d 1539 123456789\@x.y.z 1540\= Expect no match 1541 12345678\@x.y.uk 1542 1234567\@a.b.c.d 1543 1544/(a)\1{8,}/ 1545 aaaaaaaaa 1546 aaaaaaaaaa 1547\= Expect no match 1548 aaaaaaa 1549 1550/[^a]/ 1551 aaaabcd 1552 aaAabcd 1553 1554/[^a]/i 1555 aaaabcd 1556 aaAabcd 1557 1558/[^az]/ 1559 aaaabcd 1560 aaAabcd 1561 1562/[^az]/i 1563 aaaabcd 1564 aaAabcd 1565 1566/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/ 1567 \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377 1568 1569/P[^*]TAIRE[^*]{1,6}?LL/ 1570 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx 1571 1572/P[^*]TAIRE[^*]{1,}?LL/ 1573 xxxxxxxxxxxPSTAIREISLLxxxxxxxxx 1574 1575/(\.\d\d[1-9]?)\d+/ 1576 1.230003938 1577 1.875000282 1578 1.235 1579 1580/(\.\d\d((?=0)|\d(?=\d)))/ 1581 1.230003938 1582 1.875000282 1583\= Expect no match 1584 1.235 1585 1586/a(?)b/ 1587 ab 1588 1589/\b(foo)\s+(\w+)/i 1590 Food is on the foo table 1591 1592/foo(.*)bar/ 1593 The food is under the bar in the barn. 1594 1595/foo(.*?)bar/ 1596 The food is under the bar in the barn. 1597 1598/(.*)(\d*)/ 1599 I have 2 numbers: 53147 1600 1601/(.*)(\d+)/ 1602 I have 2 numbers: 53147 1603 1604/(.*?)(\d*)/ 1605 I have 2 numbers: 53147 1606 1607/(.*?)(\d+)/ 1608 I have 2 numbers: 53147 1609 1610/(.*)(\d+)$/ 1611 I have 2 numbers: 53147 1612 1613/(.*?)(\d+)$/ 1614 I have 2 numbers: 53147 1615 1616/(.*)\b(\d+)$/ 1617 I have 2 numbers: 53147 1618 1619/(.*\D)(\d+)$/ 1620 I have 2 numbers: 53147 1621 1622/^\D*(?!123)/ 1623 ABC123 1624 1625/^(\D*)(?=\d)(?!123)/ 1626 ABC445 1627\= Expect no match 1628 ABC123 1629 1630/^[W-]46]/ 1631 W46]789 1632 -46]789 1633\= Expect no match 1634 Wall 1635 Zebra 1636 42 1637 [abcd] 1638 ]abcd[ 1639 1640/^[W-\]46]/ 1641 W46]789 1642 Wall 1643 Zebra 1644 Xylophone 1645 42 1646 [abcd] 1647 ]abcd[ 1648 \\backslash 1649\= Expect no match 1650 -46]789 1651 well 1652 1653/\d\d\/\d\d\/\d\d\d\d/ 1654 01/01/2000 1655 1656/word (?:[a-zA-Z0-9]+ ){0,10}otherword/ 1657 word cat dog elephant mussel cow horse canary baboon snake shark otherword 1658\= Expect no match 1659 word cat dog elephant mussel cow horse canary baboon snake shark 1660 1661/word (?:[a-zA-Z0-9]+ ){0,300}otherword/ 1662\= Expect no match 1663 word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope 1664 1665/^(a){0,0}/ 1666 bcd 1667 abc 1668 aab 1669 1670/^(a){0,1}/ 1671 bcd 1672 abc 1673 aab 1674 1675/^(a){0,2}/ 1676 bcd 1677 abc 1678 aab 1679 1680/^(a){0,3}/ 1681 bcd 1682 abc 1683 aab 1684 aaa 1685 1686/^(a){0,}/ 1687 bcd 1688 abc 1689 aab 1690 aaa 1691 aaaaaaaa 1692 1693/^(a){1,1}/ 1694 abc 1695 aab 1696\= Expect no match 1697 bcd 1698 1699/^(a){1,2}/ 1700 abc 1701 aab 1702\= Expect no match 1703 bcd 1704 1705/^(a){1,3}/ 1706 abc 1707 aab 1708 aaa 1709\= Expect no match 1710 bcd 1711 1712/^(a){1,}/ 1713 abc 1714 aab 1715 aaa 1716 aaaaaaaa 1717\= Expect no match 1718 bcd 1719 1720/.*\.gif/ 1721 borfle\nbib.gif\nno 1722 1723/.{0,}\.gif/ 1724 borfle\nbib.gif\nno 1725 1726/.*\.gif/m 1727 borfle\nbib.gif\nno 1728 1729/.*\.gif/s 1730 borfle\nbib.gif\nno 1731 1732/.*\.gif/ms 1733 borfle\nbib.gif\nno 1734 1735/.*$/ 1736 borfle\nbib.gif\nno 1737 1738/.*$/m 1739 borfle\nbib.gif\nno 1740 1741/.*$/s 1742 borfle\nbib.gif\nno 1743 1744/.*$/ms 1745 borfle\nbib.gif\nno 1746 1747/.*$/ 1748 borfle\nbib.gif\nno\n 1749 1750/.*$/m 1751 borfle\nbib.gif\nno\n 1752 1753/.*$/s 1754 borfle\nbib.gif\nno\n 1755 1756/.*$/ms 1757 borfle\nbib.gif\nno\n 1758 1759/(.*X|^B)/ 1760 abcde\n1234Xyz 1761 BarFoo 1762\= Expect no match 1763 abcde\nBar 1764 1765/(.*X|^B)/m 1766 abcde\n1234Xyz 1767 BarFoo 1768 abcde\nBar 1769 1770/(.*X|^B)/s 1771 abcde\n1234Xyz 1772 BarFoo 1773\= Expect no match 1774 abcde\nBar 1775 1776/(.*X|^B)/ms 1777 abcde\n1234Xyz 1778 BarFoo 1779 abcde\nBar 1780 1781/(?s)(.*X|^B)/ 1782 abcde\n1234Xyz 1783 BarFoo 1784\= Expect no match 1785 abcde\nBar 1786 1787/(?s:.*X|^B)/ 1788 abcde\n1234Xyz 1789 BarFoo 1790\= Expect no match 1791 abcde\nBar 1792 1793/^.*B/ 1794\= Expect no match 1795 abc\nB 1796 1797/(?s)^.*B/ 1798 abc\nB 1799 1800/(?m)^.*B/ 1801 abc\nB 1802 1803/(?ms)^.*B/ 1804 abc\nB 1805 1806/(?ms)^B/ 1807 abc\nB 1808 1809/(?s)B$/ 1810 B\n 1811 1812/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/ 1813 123456654321 1814 1815/^\d\d\d\d\d\d\d\d\d\d\d\d/ 1816 123456654321 1817 1818/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/ 1819 123456654321 1820 1821/^[abc]{12}/ 1822 abcabcabcabc 1823 1824/^[a-c]{12}/ 1825 abcabcabcabc 1826 1827/^(a|b|c){12}/ 1828 abcabcabcabc 1829 1830/^[abcdefghijklmnopqrstuvwxy0123456789]/ 1831 n 1832\= Expect no match 1833 z 1834 1835/abcde{0,0}/ 1836 abcd 1837\= Expect no match 1838 abce 1839 1840/ab[cd]{0,0}e/ 1841 abe 1842\= Expect no match 1843 abcde 1844 1845/ab(c){0,0}d/ 1846 abd 1847\= Expect no match 1848 abcd 1849 1850/a(b*)/ 1851 a 1852 ab 1853 abbbb 1854\= Expect no match 1855 bbbbb 1856 1857/ab\d{0}e/ 1858 abe 1859\= Expect no match 1860 ab1e 1861 1862/"([^\\"]+|\\.)*"/ 1863 the \"quick\" brown fox 1864 \"the \\\"quick\\\" brown fox\" 1865 1866/.*?/g,aftertext 1867 abc 1868 1869/\b/g,aftertext 1870 abc 1871 1872/\b/g,aftertext 1873 abc 1874 1875//g 1876 abc 1877 1878/<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>/is 1879 <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR> 1880 1881/a[^a]b/ 1882 acb 1883 a\nb 1884 1885/a.b/ 1886 acb 1887\= Expect no match 1888 a\nb 1889 1890/a[^a]b/s 1891 acb 1892 a\nb 1893 1894/a.b/s 1895 acb 1896 a\nb 1897 1898/^(b+?|a){1,2}?c/ 1899 bac 1900 bbac 1901 bbbac 1902 bbbbac 1903 bbbbbac 1904 1905/^(b+|a){1,2}?c/ 1906 bac 1907 bbac 1908 bbbac 1909 bbbbac 1910 bbbbbac 1911 1912/(?!\A)x/m 1913 a\bx\n 1914 a\nx\n 1915\= Expect no match 1916 x\nb\n 1917 1918/(A|B)*?CD/ 1919 CD 1920 1921/(A|B)*CD/ 1922 CD 1923 1924/(AB)*?\1/ 1925 ABABAB 1926 1927/(AB)*\1/ 1928 ABABAB 1929 1930/(?<!bar)foo/ 1931 foo 1932 catfood 1933 arfootle 1934 rfoosh 1935\= Expect no match 1936 barfoo 1937 towbarfoo 1938 1939/\w{3}(?<!bar)foo/ 1940 catfood 1941\= Expect no match 1942 foo 1943 barfoo 1944 towbarfoo 1945 1946/(?<=(foo)a)bar/ 1947 fooabar 1948\= Expect no match 1949 bar 1950 foobbar 1951 1952/\Aabc\z/m 1953 abc 1954\= Expect no match 1955 abc\n 1956 qqq\nabc 1957 abc\nzzz 1958 qqq\nabc\nzzz 1959 1960"(?>.*/)foo" 1961 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo 1962\= Expect no match 1963 /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/ 1964 1965/(?>(\.\d\d[1-9]?))\d+/ 1966 1.230003938 1967 1.875000282 1968\= Expect no match 1969 1.235 1970 1971/^((?>\w+)|(?>\s+))*$/ 1972 now is the time for all good men to come to the aid of the party 1973\= Expect no match 1974 this is not a line with only words and spaces! 1975 1976/(\d+)(\w)/ 1977 12345a 1978 12345+ 1979 1980/((?>\d+))(\w)/ 1981 12345a 1982\= Expect no match 1983 12345+ 1984 1985/(?>a+)b/ 1986 aaab 1987 1988/((?>a+)b)/ 1989 aaab 1990 1991/(?>(a+))b/ 1992 aaab 1993 1994/(?>b)+/ 1995 aaabbbccc 1996 1997/(?>a+|b+|c+)*c/ 1998 aaabbbbccccd 1999 2000/((?>[^()]+)|\([^()]*\))+/ 2001 ((abc(ade)ufh()()x 2002 2003/\(((?>[^()]+)|\([^()]+\))+\)/ 2004 (abc) 2005 (abc(def)xyz) 2006\= Expect no match 2007 ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 2008 2009/a(?-i)b/i 2010 ab 2011 Ab 2012\= Expect no match 2013 aB 2014 AB 2015 2016/(a (?x)b c)d e/ 2017 a bcd e 2018\= Expect no match 2019 a b cd e 2020 abcd e 2021 a bcde 2022 2023/(a b(?x)c d (?-x)e f)/ 2024 a bcde f 2025\= Expect no match 2026 abcdef 2027 2028/(a(?i)b)c/ 2029 abc 2030 aBc 2031\= Expect no match 2032 abC 2033 aBC 2034 Abc 2035 ABc 2036 ABC 2037 AbC 2038 2039/a(?i:b)c/ 2040 abc 2041 aBc 2042\= Expect no match 2043 ABC 2044 abC 2045 aBC 2046 2047/a(?i:b)*c/ 2048 aBc 2049 aBBc 2050\= Expect no match 2051 aBC 2052 aBBC 2053 2054/a(?=b(?i)c)\w\wd/ 2055 abcd 2056 abCd 2057\= Expect no match 2058 aBCd 2059 abcD 2060 2061/(?s-i:more.*than).*million/i 2062 more than million 2063 more than MILLION 2064 more \n than Million 2065\= Expect no match 2066 MORE THAN MILLION 2067 more \n than \n million 2068 2069/(?:(?s-i)more.*than).*million/i 2070 more than million 2071 more than MILLION 2072 more \n than Million 2073\= Expect no match 2074 MORE THAN MILLION 2075 more \n than \n million 2076 2077/(?>a(?i)b+)+c/ 2078 abc 2079 aBbc 2080 aBBc 2081\= Expect no match 2082 Abc 2083 abAb 2084 abbC 2085 2086/(?=a(?i)b)\w\wc/ 2087 abc 2088 aBc 2089\= Expect no match 2090 Ab 2091 abC 2092 aBC 2093 2094/(?<=a(?i)b)(\w\w)c/ 2095 abxxc 2096 aBxxc 2097\= Expect no match 2098 Abxxc 2099 ABxxc 2100 abxxC 2101 2102/(?:(a)|b)(?(1)A|B)/ 2103 aA 2104 bB 2105\= Expect no match 2106 aB 2107 bA 2108 2109/^(a)?(?(1)a|b)+$/ 2110 aa 2111 b 2112 bb 2113\= Expect no match 2114 ab 2115 2116# Perl gets this next one wrong if the pattern ends with $; in that case it 2117# fails to match "12". 2118 2119/^(?(?=abc)\w{3}:|\d\d)/ 2120 abc: 2121 12 2122 123 2123\= Expect no match 2124 xyz 2125 2126/^(?(?!abc)\d\d|\w{3}:)$/ 2127 abc: 2128 12 2129\= Expect no match 2130 123 2131 xyz 2132 2133/(?(?<=foo)bar|cat)/ 2134 foobar 2135 cat 2136 fcat 2137 focat 2138\= Expect no match 2139 foocat 2140 2141/(?(?<!foo)cat|bar)/ 2142 foobar 2143 cat 2144 fcat 2145 focat 2146\= Expect no match 2147 foocat 2148 2149/( \( )? [^()]+ (?(1) \) |) /x 2150 abcd 2151 (abcd) 2152 the quick (abcd) fox 2153 (abcd 2154 2155/( \( )? [^()]+ (?(1) \) ) /x 2156 abcd 2157 (abcd) 2158 the quick (abcd) fox 2159 (abcd 2160 2161/^(?(2)a|(1)(2))+$/ 2162 12 2163 12a 2164 12aa 2165\= Expect no match 2166 1234 2167 2168/((?i)blah)\s+\1/ 2169 blah blah 2170 BLAH BLAH 2171 Blah Blah 2172 blaH blaH 2173\= Expect no match 2174 blah BLAH 2175 Blah blah 2176 blaH blah 2177 2178/((?i)blah)\s+(?i:\1)/ 2179 blah blah 2180 BLAH BLAH 2181 Blah Blah 2182 blaH blaH 2183 blah BLAH 2184 Blah blah 2185 blaH blah 2186 2187/((?i)blah)\s+(?m)A(?i:\1)/ 2188 blah ABLAH 2189\= Expect no match 2190 blah aBLAH 2191 2192/(?>a*)*/ 2193 a 2194 aa 2195 aaaa 2196 2197/(abc|)+/ 2198 abc 2199 abcabc 2200 abcabcabc 2201 xyz 2202 2203/([a]*)*/ 2204 a 2205 aaaaa 2206 2207/([ab]*)*/ 2208 a 2209 b 2210 ababab 2211 aaaabcde 2212 bbbb 2213 2214/([^a]*)*/ 2215 b 2216 bbbb 2217 aaa 2218 2219/([^ab]*)*/ 2220 cccc 2221 abab 2222 2223/([a]*?)*/ 2224 a 2225 aaaa 2226 2227/([ab]*?)*/ 2228 a 2229 b 2230 abab 2231 baba 2232 2233/([^a]*?)*/ 2234 b 2235 bbbb 2236 aaa 2237 2238/([^ab]*?)*/ 2239 c 2240 cccc 2241 baba 2242 2243/(?>a*)*/ 2244 a 2245 aaabcde 2246 2247/((?>a*))*/ 2248 aaaaa 2249 aabbaa 2250 2251/((?>a*?))*/ 2252 aaaaa 2253 aabbaa 2254 2255/(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x 2256 12-sep-98 2257 12-09-98 2258\= Expect no match 2259 sep-12-98 2260 2261/(?<=(foo))bar\1/ 2262 foobarfoo 2263 foobarfootling 2264\= Expect no match 2265 foobar 2266 barfoo 2267 2268/(?i:saturday|sunday)/ 2269 saturday 2270 sunday 2271 Saturday 2272 Sunday 2273 SATURDAY 2274 SUNDAY 2275 SunDay 2276 2277/(a(?i)bc|BB)x/ 2278 abcx 2279 aBCx 2280 bbx 2281 BBx 2282\= Expect no match 2283 abcX 2284 aBCX 2285 bbX 2286 BBX 2287 2288/^([ab](?i)[cd]|[ef])/ 2289 ac 2290 aC 2291 bD 2292 elephant 2293 Europe 2294 frog 2295 France 2296\= Expect no match 2297 Africa 2298 2299/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/ 2300 ab 2301 aBd 2302 xy 2303 xY 2304 zebra 2305 Zambesi 2306\= Expect no match 2307 aCD 2308 XY 2309 2310/(?<=foo\n)^bar/m 2311 foo\nbar 2312\= Expect no match 2313 bar 2314 baz\nbar 2315 2316/(?<=(?<!foo)bar)baz/ 2317 barbaz 2318 barbarbaz 2319 koobarbaz 2320\= Expect no match 2321 baz 2322 foobarbaz 2323 2324# The cases of aaaa and aaaaaa are missed out below because Perl does things 2325# differently. We know that odd, and maybe incorrect, things happen with 2326# recursive references in Perl, as far as 5.11.3 - see some stuff in test #2. 2327 2328/^(a\1?){4}$/ 2329 aaaaa 2330 aaaaaaa 2331 aaaaaaaaaa 2332\= Expect no match 2333 a 2334 aa 2335 aaa 2336 aaaaaaaa 2337 aaaaaaaaa 2338 aaaaaaaaaaa 2339 aaaaaaaaaaaa 2340 aaaaaaaaaaaaa 2341 aaaaaaaaaaaaaa 2342 aaaaaaaaaaaaaaa 2343 aaaaaaaaaaaaaaaa 2344 2345/^(a\1?)(a\1?)(a\2?)(a\3?)$/ 2346 aaaa 2347 aaaaa 2348 aaaaaa 2349 aaaaaaa 2350 aaaaaaaaaa 2351\= Expect no match 2352 a 2353 aa 2354 aaa 2355 aaaaaaaa 2356 aaaaaaaaa 2357 aaaaaaaaaaa 2358 aaaaaaaaaaaa 2359 aaaaaaaaaaaaa 2360 aaaaaaaaaaaaaa 2361 aaaaaaaaaaaaaaa 2362 aaaaaaaaaaaaaaaa 2363 2364# The following tests are taken from the Perl 5.005 test suite; some of them 2365# are compatible with 5.004, but I'd rather not have to sort them out. 2366 2367/abc/ 2368 abc 2369 xabcy 2370 ababc 2371\= Expect no match 2372 xbc 2373 axc 2374 abx 2375 2376/ab*c/ 2377 abc 2378 2379/ab*bc/ 2380 abc 2381 abbc 2382 abbbbc 2383 2384/.{1}/ 2385 abbbbc 2386 2387/.{3,4}/ 2388 abbbbc 2389 2390/ab{0,}bc/ 2391 abbbbc 2392 2393/ab+bc/ 2394 abbc 2395\= Expect no match 2396 abc 2397 abq 2398 2399/ab{1,}bc/ 2400 2401/ab+bc/ 2402 abbbbc 2403 2404/ab{1,}bc/ 2405 abbbbc 2406 2407/ab{1,3}bc/ 2408 abbbbc 2409 2410/ab{3,4}bc/ 2411 abbbbc 2412 2413/ab{4,5}bc/ 2414\= Expect no match 2415 abq 2416 abbbbc 2417 2418/ab?bc/ 2419 abbc 2420 abc 2421 2422/ab{0,1}bc/ 2423 abc 2424 2425/ab?bc/ 2426 2427/ab?c/ 2428 abc 2429 2430/ab{0,1}c/ 2431 abc 2432 2433/^abc$/ 2434 abc 2435\= Expect no match 2436 abbbbc 2437 abcc 2438 2439/^abc/ 2440 abcc 2441 2442/^abc$/ 2443 2444/abc$/ 2445 aabc 2446\= Expect no match 2447 aabcd 2448 2449/^/ 2450 abc 2451 2452/$/ 2453 abc 2454 2455/a.c/ 2456 abc 2457 axc 2458 2459/a.*c/ 2460 axyzc 2461 2462/a[bc]d/ 2463 abd 2464\= Expect no match 2465 axyzd 2466 abc 2467 2468/a[b-d]e/ 2469 ace 2470 2471/a[b-d]/ 2472 aac 2473 2474/a[-b]/ 2475 a- 2476 2477/a[b-]/ 2478 a- 2479 2480/a]/ 2481 a] 2482 2483/a[]]b/ 2484 a]b 2485 2486/a[^bc]d/ 2487 aed 2488\= Expect no match 2489 abd 2490 abd 2491 2492/a[^-b]c/ 2493 adc 2494 2495/a[^]b]c/ 2496 adc 2497 a-c 2498\= Expect no match 2499 a]c 2500 2501/\ba\b/ 2502 a- 2503 -a 2504 -a- 2505 2506/\by\b/ 2507\= Expect no match 2508 xy 2509 yz 2510 xyz 2511 2512/\Ba\B/ 2513\= Expect no match 2514 a- 2515 -a 2516 -a- 2517 2518/\By\b/ 2519 xy 2520 2521/\by\B/ 2522 yz 2523 2524/\By\B/ 2525 xyz 2526 2527/\w/ 2528 a 2529 2530/\W/ 2531 - 2532\= Expect no match 2533 a 2534 2535/a\sb/ 2536 a b 2537 2538/a\Sb/ 2539 a-b 2540\= Expect no match 2541 a b 2542 2543/\d/ 2544 1 2545 2546/\D/ 2547 - 2548\= Expect no match 2549 1 2550 2551/[\w]/ 2552 a 2553 2554/[\W]/ 2555 - 2556\= Expect no match 2557 a 2558 2559/a[\s]b/ 2560 a b 2561 2562/a[\S]b/ 2563 a-b 2564\= Expect no match 2565 a b 2566 2567/[\d]/ 2568 1 2569 2570/[\D]/ 2571 - 2572\= Expect no match 2573 1 2574 2575/ab|cd/ 2576 abc 2577 abcd 2578 2579/()ef/ 2580 def 2581 2582/$b/ 2583 2584/a\(b/ 2585 a(b 2586 2587/a\(*b/ 2588 ab 2589 a((b 2590 2591/a\\b/ 2592 a\\b 2593 2594/((a))/ 2595 abc 2596 2597/(a)b(c)/ 2598 abc 2599 2600/a+b+c/ 2601 aabbabc 2602 2603/a{1,}b{1,}c/ 2604 aabbabc 2605 2606/a.+?c/ 2607 abcabc 2608 2609/(a+|b)*/ 2610 ab 2611 2612/(a+|b){0,}/ 2613 ab 2614 2615/(a+|b)+/ 2616 ab 2617 2618/(a+|b){1,}/ 2619 ab 2620 2621/(a+|b)?/ 2622 ab 2623 2624/(a+|b){0,1}/ 2625 ab 2626 2627/[^ab]*/ 2628 cde 2629 2630/abc/ 2631\= Expect no match 2632 b 2633 2634/a*/ 2635 \ 2636 2637/([abc])*d/ 2638 abbbcd 2639 2640/([abc])*bcd/ 2641 abcd 2642 2643/a|b|c|d|e/ 2644 e 2645 2646/(a|b|c|d|e)f/ 2647 ef 2648 2649/abcd*efg/ 2650 abcdefg 2651 2652/ab*/ 2653 xabyabbbz 2654 xayabbbz 2655 2656/(ab|cd)e/ 2657 abcde 2658 2659/[abhgefdc]ij/ 2660 hij 2661 2662/^(ab|cd)e/ 2663 2664/(abc|)ef/ 2665 abcdef 2666 2667/(a|b)c*d/ 2668 abcd 2669 2670/(ab|ab*)bc/ 2671 abc 2672 2673/a([bc]*)c*/ 2674 abc 2675 2676/a([bc]*)(c*d)/ 2677 abcd 2678 2679/a([bc]+)(c*d)/ 2680 abcd 2681 2682/a([bc]*)(c+d)/ 2683 abcd 2684 2685/a[bcd]*dcdcde/ 2686 adcdcde 2687 2688/a[bcd]+dcdcde/ 2689\= Expect no match 2690 abcde 2691 adcdcde 2692 2693/(ab|a)b*c/ 2694 abc 2695 2696/((a)(b)c)(d)/ 2697 abcd 2698 2699/[a-zA-Z_][a-zA-Z0-9_]*/ 2700 alpha 2701 2702/^a(bc+|b[eh])g|.h$/ 2703 abh 2704 2705/(bc+d$|ef*g.|h?i(j|k))/ 2706 effgz 2707 ij 2708 reffgz 2709\= Expect no match 2710 effg 2711 bcdd 2712 2713/((((((((((a))))))))))/ 2714 a 2715 2716/((((((((((a))))))))))\10/ 2717 aa 2718 2719/(((((((((a)))))))))/ 2720 a 2721 2722/multiple words of text/ 2723\= Expect no match 2724 aa 2725 uh-uh 2726 2727/multiple words/ 2728 multiple words, yeah 2729 2730/(.*)c(.*)/ 2731 abcde 2732 2733/\((.*), (.*)\)/ 2734 (a, b) 2735 2736/[k]/ 2737 2738/abcd/ 2739 abcd 2740 2741/a(bc)d/ 2742 abcd 2743 2744/a[-]?c/ 2745 ac 2746 2747/(abc)\1/ 2748 abcabc 2749 2750/([a-c]*)\1/ 2751 abcabc 2752 2753/(a)|\1/ 2754 a 2755 ab 2756\= Expect no match 2757 x 2758 2759/(([a-c])b*?\2)*/ 2760 ababbbcbc 2761 2762/(([a-c])b*?\2){3}/ 2763 ababbbcbc 2764 2765/((\3|b)\2(a)x)+/ 2766 aaaxabaxbaaxbbax 2767 2768/((\3|b)\2(a)){2,}/ 2769 bbaababbabaaaaabbaaaabba 2770 2771/abc/i 2772 ABC 2773 XABCY 2774 ABABC 2775\= Expect no match 2776 aaxabxbaxbbx 2777 XBC 2778 AXC 2779 ABX 2780 2781/ab*c/i 2782 ABC 2783 2784/ab*bc/i 2785 ABC 2786 ABBC 2787 2788/ab*?bc/i 2789 ABBBBC 2790 2791/ab{0,}?bc/i 2792 ABBBBC 2793 2794/ab+?bc/i 2795 ABBC 2796 2797/ab+bc/i 2798\= Expect no match 2799 ABC 2800 ABQ 2801 2802/ab{1,}bc/i 2803 2804/ab+bc/i 2805 ABBBBC 2806 2807/ab{1,}?bc/i 2808 ABBBBC 2809 2810/ab{1,3}?bc/i 2811 ABBBBC 2812 2813/ab{3,4}?bc/i 2814 ABBBBC 2815 2816/ab{4,5}?bc/i 2817\= Expect no match 2818 ABQ 2819 ABBBBC 2820 2821/ab??bc/i 2822 ABBC 2823 ABC 2824 2825/ab{0,1}?bc/i 2826 ABC 2827 2828/ab??bc/i 2829 2830/ab??c/i 2831 ABC 2832 2833/ab{0,1}?c/i 2834 ABC 2835 2836/^abc$/i 2837 ABC 2838\= Expect no match 2839 ABBBBC 2840 ABCC 2841 2842/^abc/i 2843 ABCC 2844 2845/^abc$/i 2846 2847/abc$/i 2848 AABC 2849 2850/^/i 2851 ABC 2852 2853/$/i 2854 ABC 2855 2856/a.c/i 2857 ABC 2858 AXC 2859 2860/a.*?c/i 2861 AXYZC 2862 2863/a.*c/i 2864 AABC 2865\= Expect no match 2866 AXYZD 2867 2868/a[bc]d/i 2869 ABD 2870 2871/a[b-d]e/i 2872 ACE 2873\= Expect no match 2874 ABC 2875 ABD 2876 2877/a[b-d]/i 2878 AAC 2879 2880/a[-b]/i 2881 A- 2882 2883/a[b-]/i 2884 A- 2885 2886/a]/i 2887 A] 2888 2889/a[]]b/i 2890 A]B 2891 2892/a[^bc]d/i 2893 AED 2894 2895/a[^-b]c/i 2896 ADC 2897\= Expect no match 2898 ABD 2899 A-C 2900 2901/a[^]b]c/i 2902 ADC 2903 2904/ab|cd/i 2905 ABC 2906 ABCD 2907 2908/()ef/i 2909 DEF 2910 2911/$b/i 2912\= Expect no match 2913 A]C 2914 B 2915 2916/a\(b/i 2917 A(B 2918 2919/a\(*b/i 2920 AB 2921 A((B 2922 2923/a\\b/i 2924 A\\b 2925 a\\B 2926 2927/((a))/i 2928 ABC 2929 2930/(a)b(c)/i 2931 ABC 2932 2933/a+b+c/i 2934 AABBABC 2935 2936/a{1,}b{1,}c/i 2937 AABBABC 2938 2939/a.+?c/i 2940 ABCABC 2941 2942/a.*?c/i 2943 ABCABC 2944 2945/a.{0,5}?c/i 2946 ABCABC 2947 2948/(a+|b)*/i 2949 AB 2950 2951/(a+|b){0,}/i 2952 AB 2953 2954/(a+|b)+/i 2955 AB 2956 2957/(a+|b){1,}/i 2958 AB 2959 2960/(a+|b)?/i 2961 AB 2962 2963/(a+|b){0,1}/i 2964 AB 2965 2966/(a+|b){0,1}?/i 2967 AB 2968 2969/[^ab]*/i 2970 CDE 2971 2972/([abc])*d/i 2973 ABBBCD 2974 2975/([abc])*bcd/i 2976 ABCD 2977 2978/a|b|c|d|e/i 2979 E 2980 2981/(a|b|c|d|e)f/i 2982 EF 2983 2984/abcd*efg/i 2985 ABCDEFG 2986 2987/ab*/i 2988 XABYABBBZ 2989 XAYABBBZ 2990 2991/(ab|cd)e/i 2992 ABCDE 2993 2994/[abhgefdc]ij/i 2995 HIJ 2996 2997/^(ab|cd)e/i 2998\= Expect no match 2999 ABCDE 3000 3001/(abc|)ef/i 3002 ABCDEF 3003 3004/(a|b)c*d/i 3005 ABCD 3006 3007/(ab|ab*)bc/i 3008 ABC 3009 3010/a([bc]*)c*/i 3011 ABC 3012 3013/a([bc]*)(c*d)/i 3014 ABCD 3015 3016/a([bc]+)(c*d)/i 3017 ABCD 3018 3019/a([bc]*)(c+d)/i 3020 ABCD 3021 3022/a[bcd]*dcdcde/i 3023 ADCDCDE 3024 3025/a[bcd]+dcdcde/i 3026 3027/(ab|a)b*c/i 3028 ABC 3029 3030/((a)(b)c)(d)/i 3031 ABCD 3032 3033/[a-zA-Z_][a-zA-Z0-9_]*/i 3034 ALPHA 3035 3036/^a(bc+|b[eh])g|.h$/i 3037 ABH 3038 3039/(bc+d$|ef*g.|h?i(j|k))/i 3040 EFFGZ 3041 IJ 3042 REFFGZ 3043\= Expect no match 3044 ADCDCDE 3045 EFFG 3046 BCDD 3047 3048/((((((((((a))))))))))/i 3049 A 3050 3051/((((((((((a))))))))))\10/i 3052 AA 3053 3054/(((((((((a)))))))))/i 3055 A 3056 3057/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i 3058 A 3059 3060/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i 3061 C 3062 3063/multiple words of text/i 3064\= Expect no match 3065 AA 3066 UH-UH 3067 3068/multiple words/i 3069 MULTIPLE WORDS, YEAH 3070 3071/(.*)c(.*)/i 3072 ABCDE 3073 3074/\((.*), (.*)\)/i 3075 (A, B) 3076 3077/[k]/i 3078 3079/abcd/i 3080 ABCD 3081 3082/a(bc)d/i 3083 ABCD 3084 3085/a[-]?c/i 3086 AC 3087 3088/(abc)\1/i 3089 ABCABC 3090 3091/([a-c]*)\1/i 3092 ABCABC 3093 3094/a(?!b)./ 3095 abad 3096 3097/a(?=d)./ 3098 abad 3099 3100/a(?=c|d)./ 3101 abad 3102 3103/a(?:b|c|d)(.)/ 3104 ace 3105 3106/a(?:b|c|d)*(.)/ 3107 ace 3108 3109/a(?:b|c|d)+?(.)/ 3110 ace 3111 acdbcdbe 3112 3113/a(?:b|c|d)+(.)/ 3114 acdbcdbe 3115 3116/a(?:b|c|d){2}(.)/ 3117 acdbcdbe 3118 3119/a(?:b|c|d){4,5}(.)/ 3120 acdbcdbe 3121 3122/a(?:b|c|d){4,5}?(.)/ 3123 acdbcdbe 3124 3125/((foo)|(bar))*/ 3126 foobar 3127 3128/a(?:b|c|d){6,7}(.)/ 3129 acdbcdbe 3130 3131/a(?:b|c|d){6,7}?(.)/ 3132 acdbcdbe 3133 3134/a(?:b|c|d){5,6}(.)/ 3135 acdbcdbe 3136 3137/a(?:b|c|d){5,6}?(.)/ 3138 acdbcdbe 3139 3140/a(?:b|c|d){5,7}(.)/ 3141 acdbcdbe 3142 3143/a(?:b|c|d){5,7}?(.)/ 3144 acdbcdbe 3145 3146/a(?:b|(c|e){1,2}?|d)+?(.)/ 3147 ace 3148 3149/^(.+)?B/ 3150 AB 3151 3152/^([^a-z])|(\^)$/ 3153 . 3154 3155/^[<>]&/ 3156 <&OUT 3157 3158/^(a\1?){4}$/ 3159 aaaaaaaaaa 3160\= Expect no match 3161 AB 3162 aaaaaaaaa 3163 aaaaaaaaaaa 3164 3165/^(a(?(1)\1)){4}$/ 3166 aaaaaaaaaa 3167\= Expect no match 3168 aaaaaaaaa 3169 aaaaaaaaaaa 3170 3171/(?:(f)(o)(o)|(b)(a)(r))*/ 3172 foobar 3173 3174/(?<=a)b/ 3175 ab 3176\= Expect no match 3177 cb 3178 b 3179 3180/(?<!c)b/ 3181 ab 3182 b 3183 b 3184 3185/(?:..)*a/ 3186 aba 3187 3188/(?:..)*?a/ 3189 aba 3190 3191/^(?:b|a(?=(.)))*\1/ 3192 abc 3193 3194/^(){3,5}/ 3195 abc 3196 3197/^(a+)*ax/ 3198 aax 3199 3200/^((a|b)+)*ax/ 3201 aax 3202 3203/^((a|bc)+)*ax/ 3204 aax 3205 3206/(a|x)*ab/ 3207 cab 3208 3209/(a)*ab/ 3210 cab 3211 3212/(?:(?i)a)b/ 3213 ab 3214 3215/((?i)a)b/ 3216 ab 3217 3218/(?:(?i)a)b/ 3219 Ab 3220 3221/((?i)a)b/ 3222 Ab 3223 3224/(?:(?i)a)b/ 3225\= Expect no match 3226 cb 3227 aB 3228 3229/((?i)a)b/ 3230 3231/(?i:a)b/ 3232 ab 3233 3234/((?i:a))b/ 3235 ab 3236 3237/(?i:a)b/ 3238 Ab 3239 3240/((?i:a))b/ 3241 Ab 3242 3243/(?i:a)b/ 3244\= Expect no match 3245 aB 3246 aB 3247 3248/((?i:a))b/ 3249 3250/(?:(?-i)a)b/i 3251 ab 3252 3253/((?-i)a)b/i 3254 ab 3255 3256/(?:(?-i)a)b/i 3257 aB 3258 3259/((?-i)a)b/i 3260 aB 3261 3262/(?:(?-i)a)b/i 3263 aB 3264\= Expect no match 3265 Ab 3266 AB 3267 3268/(?-i:a)b/i 3269 ab 3270 3271/((?-i:a))b/i 3272 ab 3273 3274/(?-i:a)b/i 3275 aB 3276 3277/((?-i:a))b/i 3278 aB 3279 3280/(?-i:a)b/i 3281\= Expect no match 3282 AB 3283 Ab 3284 3285/((?-i:a))b/i 3286 3287/(?-i:a)b/i 3288 aB 3289 3290/((?-i:a))b/i 3291 aB 3292 3293/(?-i:a)b/i 3294\= Expect no match 3295 Ab 3296 AB 3297 3298/((?-i:a))b/i 3299 3300/((?-i:a.))b/i 3301\= Expect no match 3302 AB 3303 a\nB 3304 3305/((?s-i:a.))b/i 3306 a\nB 3307 3308/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/ 3309 cabbbb 3310 3311/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/ 3312 caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3313 3314/(ab)\d\1/i 3315 Ab4ab 3316 ab4Ab 3317 3318/foo\w*\d{4}baz/ 3319 foobar1234baz 3320 3321/x(~~)*(?:(?:F)?)?/ 3322 x~~ 3323 3324/^a(?#xxx){3}c/ 3325 aaac 3326 3327/^a (?#xxx) (?#yyy) {3}c/x 3328 aaac 3329 3330/(?<![cd])b/ 3331\= Expect no match 3332 B\nB 3333 dbcb 3334 3335/(?<![cd])[ab]/ 3336 dbaacb 3337 3338/(?<!(c|d))b/ 3339 3340/(?<!(c|d))[ab]/ 3341 dbaacb 3342 3343/(?<!cd)[ab]/ 3344 cdaccb 3345 3346/^(?:a?b?)*$/ 3347 \ 3348 a 3349 ab 3350 aaa 3351\= Expect no match 3352 dbcb 3353 a-- 3354 aa-- 3355 3356/((?s)^a(.))((?m)^b$)/ 3357 a\nb\nc\n 3358 3359/((?m)^b$)/ 3360 a\nb\nc\n 3361 3362/(?m)^b/ 3363 a\nb\n 3364 3365/(?m)^(b)/ 3366 a\nb\n 3367 3368/((?m)^b)/ 3369 a\nb\n 3370 3371/\n((?m)^b)/ 3372 a\nb\n 3373 3374/((?s).)c(?!.)/ 3375 a\nb\nc\n 3376 a\nb\nc\n 3377 3378/((?s)b.)c(?!.)/ 3379 a\nb\nc\n 3380 a\nb\nc\n 3381 3382/^b/ 3383 3384/()^b/ 3385\= Expect no match 3386 a\nb\nc\n 3387 a\nb\nc\n 3388 3389/((?m)^b)/ 3390 a\nb\nc\n 3391 3392/(x)?(?(1)a|b)/ 3393\= Expect no match 3394 a 3395 a 3396 3397/(x)?(?(1)b|a)/ 3398 a 3399 3400/()?(?(1)b|a)/ 3401 a 3402 3403/()(?(1)b|a)/ 3404 3405/()?(?(1)a|b)/ 3406 a 3407 3408/^(\()?blah(?(1)(\)))$/ 3409 (blah) 3410 blah 3411\= Expect no match 3412 a 3413 blah) 3414 (blah 3415 3416/^(\(+)?blah(?(1)(\)))$/ 3417 (blah) 3418 blah 3419\= Expect no match 3420 blah) 3421 (blah 3422 3423/(?(?!a)a|b)/ 3424 3425/(?(?!a)b|a)/ 3426 a 3427 3428/(?(?=a)b|a)/ 3429\= Expect no match 3430 a 3431 a 3432 3433/(?(?=a)a|b)/ 3434 a 3435 3436/(?=(a+?))(\1ab)/ 3437 aaab 3438 3439/^(?=(a+?))\1ab/ 3440 3441/(\w+:)+/ 3442 one: 3443 3444/$(?<=^(a))/ 3445 a 3446 3447/(?=(a+?))(\1ab)/ 3448 aaab 3449 3450/^(?=(a+?))\1ab/ 3451\= Expect no match 3452 aaab 3453 aaab 3454 3455/([\w:]+::)?(\w+)$/ 3456 abcd 3457 xy:z:::abcd 3458 3459/^[^bcd]*(c+)/ 3460 aexycd 3461 3462/(a*)b+/ 3463 caab 3464 3465/([\w:]+::)?(\w+)$/ 3466 abcd 3467 xy:z:::abcd 3468\= Expect no match 3469 abcd: 3470 abcd: 3471 3472/^[^bcd]*(c+)/ 3473 aexycd 3474 3475/(>a+)ab/ 3476 3477/(?>a+)b/ 3478 aaab 3479 3480/([[:]+)/ 3481 a:[b]: 3482 3483/([[=]+)/ 3484 a=[b]= 3485 3486/([[.]+)/ 3487 a.[b]. 3488 3489/((?>a+)b)/ 3490 aaab 3491 3492/(?>(a+))b/ 3493 aaab 3494 3495/((?>[^()]+)|\([^()]*\))+/ 3496 ((abc(ade)ufh()()x 3497 3498/a\Z/ 3499\= Expect no match 3500 aaab 3501 a\nb\n 3502 3503/b\Z/ 3504 a\nb\n 3505 3506/b\z/ 3507 3508/b\Z/ 3509 a\nb 3510 3511/b\z/ 3512 a\nb 3513 3514/^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/ 3515 a 3516 abc 3517 a-b 3518 0-9 3519 a.b 3520 5.6.7 3521 the.quick.brown.fox 3522 a100.b200.300c 3523 12-ab.1245 3524\= Expect no match 3525 \ 3526 .a 3527 -a 3528 a- 3529 a. 3530 a_b 3531 a.- 3532 a.. 3533 ab..bc 3534 the.quick.brown.fox- 3535 the.quick.brown.fox. 3536 the.quick.brown.fox_ 3537 the.quick.brown.fox+ 3538 3539/(?>.*)(?<=(abcd|wxyz))/ 3540 alphabetabcd 3541 endingwxyz 3542\= Expect no match 3543 a rather long string that doesn't end with one of them 3544 3545/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/ 3546 word cat dog elephant mussel cow horse canary baboon snake shark otherword 3547\= Expect no match 3548 word cat dog elephant mussel cow horse canary baboon snake shark 3549 3550/word (?>[a-zA-Z0-9]+ ){0,30}otherword/ 3551\= Expect no match 3552 word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope 3553 3554/(?<=\d{3}(?!999))foo/ 3555 999foo 3556 123999foo 3557\= Expect no match 3558 123abcfoo 3559 3560/(?<=(?!...999)\d{3})foo/ 3561 999foo 3562 123999foo 3563\= Expect no match 3564 123abcfoo 3565 3566/(?<=\d{3}(?!999)...)foo/ 3567 123abcfoo 3568 123456foo 3569\= Expect no match 3570 123999foo 3571 3572/(?<=\d{3}...)(?<!999)foo/ 3573 123abcfoo 3574 123456foo 3575\= Expect no match 3576 123999foo 3577 3578/<a[\s]+href[\s]*=[\s]* # find <a href= 3579 ([\"\'])? # find single or double quote 3580 (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching 3581 # quote, otherwise match up to next space 3582/isx 3583 <a href=abcd xyz 3584 <a href=\"abcd xyz pqr\" cats 3585 <a href=\'abcd xyz pqr\' cats 3586 3587/<a\s+href\s*=\s* # find <a href= 3588 (["'])? # find single or double quote 3589 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching 3590 # quote, otherwise match up to next space 3591/isx 3592 <a href=abcd xyz 3593 <a href=\"abcd xyz pqr\" cats 3594 <a href = \'abcd xyz pqr\' cats 3595 3596/<a\s+href(?>\s*)=(?>\s*) # find <a href= 3597 (["'])? # find single or double quote 3598 (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching 3599 # quote, otherwise match up to next space 3600/isx 3601 <a href=abcd xyz 3602 <a href=\"abcd xyz pqr\" cats 3603 <a href = \'abcd xyz pqr\' cats 3604 3605/((Z)+|A)*/ 3606 ZABCDEFG 3607 3608/(Z()|A)*/ 3609 ZABCDEFG 3610 3611/(Z(())|A)*/ 3612 ZABCDEFG 3613 3614/((?>Z)+|A)*/ 3615 ZABCDEFG 3616 3617/((?>)+|A)*/ 3618 ZABCDEFG 3619 3620/a*/g 3621 abbab 3622 3623/[[:space:]]+/ 3624 > \x09\x0a\x0c\x0d\x0b< 3625 3626/[[:blank:]]+/ 3627 > \x09\x0a\x0c\x0d\x0b< 3628 3629/[\s]+/ 3630 > \x09\x0a\x0c\x0d\x0b< 3631 3632/\s+/ 3633 > \x09\x0a\x0c\x0d\x0b< 3634 3635/ab/x 3636 ab 3637 3638/(?!\A)x/m 3639 a\nxb\n 3640 3641/(?!^)x/m 3642\= Expect no match 3643 a\nxb\n 3644 3645/abc\Qabc\Eabc/ 3646 abcabcabc 3647 3648/abc\Q(*+|\Eabc/ 3649 abc(*+|abc 3650 3651/ abc\Q abc\Eabc/x 3652 abc abcabc 3653\= Expect no match 3654 abcabcabc 3655 3656/abc#comment 3657 \Q#not comment 3658 literal\E/x 3659 abc#not comment\n literal 3660 3661/abc#comment 3662 \Q#not comment 3663 literal/x 3664 abc#not comment\n literal 3665 3666/abc#comment 3667 \Q#not comment 3668 literal\E #more comment 3669 /x 3670 abc#not comment\n literal 3671 3672/abc#comment 3673 \Q#not comment 3674 literal\E #more comment/x 3675 abc#not comment\n literal 3676 3677/\Qabc\$xyz\E/ 3678 abc\\\$xyz 3679 3680/\Qabc\E\$\Qxyz\E/ 3681 abc\$xyz 3682 3683/\Gabc/ 3684 abc 3685\= Expect no match 3686 xyzabc 3687 3688/\Gabc./g 3689 abc1abc2xyzabc3 3690 3691/abc./g 3692 abc1abc2xyzabc3 3693 3694/a(?x: b c )d/ 3695 XabcdY 3696\= Expect no match 3697 Xa b c d Y 3698 3699/((?x)x y z | a b c)/ 3700 XabcY 3701 AxyzB 3702 3703/(?i)AB(?-i)C/ 3704 XabCY 3705\= Expect no match 3706 XabcY 3707 3708/((?i)AB(?-i)C|D)E/ 3709 abCE 3710 DE 3711\= Expect no match 3712 abcE 3713 abCe 3714 dE 3715 De 3716 3717/(.*)\d+\1/ 3718 abc123abc 3719 abc123bc 3720 3721/(.*)\d+\1/s 3722 abc123abc 3723 abc123bc 3724 3725/((.*))\d+\1/ 3726 abc123abc 3727 abc123bc 3728 3729# This tests for an IPv6 address in the form where it can have up to 3730# eight components, one and only one of which is empty. This must be 3731# an internal component. 3732 3733/^(?!:) # colon disallowed at start 3734 (?: # start of item 3735 (?: [0-9a-f]{1,4} | # 1-4 hex digits or 3736 (?(1)0 | () ) ) # if null previously matched, fail; else null 3737 : # followed by colon 3738 ){1,7} # end item; 1-7 of them required 3739 [0-9a-f]{1,4} $ # final hex number at end of string 3740 (?(1)|.) # check that there was an empty component 3741 /ix 3742 a123::a123 3743 a123:b342::abcd 3744 a123:b342::324e:abcd 3745 a123:ddde:b342::324e:abcd 3746 a123:ddde:b342::324e:dcba:abcd 3747 a123:ddde:9999:b342::324e:dcba:abcd 3748\= Expect no match 3749 1:2:3:4:5:6:7:8 3750 a123:bce:ddde:9999:b342::324e:dcba:abcd 3751 a123::9999:b342::324e:dcba:abcd 3752 abcde:2:3:4:5:6:7:8 3753 ::1 3754 abcd:fee0:123:: 3755 :1 3756 1: 3757 3758/[z\Qa-d]\E]/ 3759 z 3760 a 3761 - 3762 d 3763 ] 3764\= Expect no match 3765 b 3766 3767/(a+)*b/ 3768\= Expect no match 3769 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3770 3771/(?i)reg(?:ul(?:[a�]|ae)r|ex)/ 3772 REGular 3773 regulaer 3774 Regex 3775 regul�r 3776 3777/����[�-��-�]+/ 3778 ����� 3779 ����� 3780 ����� 3781 ����� 3782 3783/(?<=Z)X./ 3784 \x84XAZXB 3785 3786/ab cd (?x) de fg/ 3787 ab cd defg 3788 3789/ab cd(?x) de fg/ 3790 ab cddefg 3791\= Expect no match 3792 abcddefg 3793 3794/(?<![^f]oo)(bar)/ 3795 foobarX 3796\= Expect no match 3797 boobarX 3798 3799/(?<![^f])X/ 3800 offX 3801\= Expect no match 3802 onyX 3803 3804/(?<=[^f])X/ 3805 onyX 3806\= Expect no match 3807 offX 3808 3809/^/gm 3810 a\nb\nc\n 3811 \ 3812 3813/(?<=C\n)^/gm 3814 A\nC\nC\n 3815 3816/(?:(?(1)a|b)(X))+/ 3817 bXaX 3818 3819/(?:(?(1)\1a|b)(X|Y))+/ 3820 bXXaYYaY 3821 bXYaXXaX 3822 3823/()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/ 3824 bXXaYYaY 3825 3826/[[,abc,]+]/ 3827 abc] 3828 a,b] 3829 [a,b,c] 3830 3831/(?-x: )/x 3832 A\x20B 3833 3834"(?x)(?-x: \s*#\s*)" 3835 A # B 3836\= Expect no match 3837 # 3838 3839"(?x-is)(?:(?-ixs) \s*#\s*) include" 3840 A #include 3841\= Expect no match 3842 A#include 3843 A #Include 3844 3845/a*b*\w/ 3846 aaabbbb 3847 aaaa 3848 a 3849 3850/a*b?\w/ 3851 aaabbbb 3852 aaaa 3853 a 3854 3855/a*b{0,4}\w/ 3856 aaabbbb 3857 aaaa 3858 a 3859 3860/a*b{0,}\w/ 3861 aaabbbb 3862 aaaa 3863 a 3864 3865/a*\d*\w/ 3866 0a 3867 a 3868 3869/a*b *\w/x 3870 a 3871 3872/a*b#comment 3873 *\w/x 3874 a 3875 3876/a* b *\w/x 3877 a 3878 3879/^\w+=.*(\\\n.*)*/ 3880 abc=xyz\\\npqr 3881 3882/(?=(\w+))\1:/ 3883 abcd: 3884 3885/^(?=(\w+))\1:/ 3886 abcd: 3887 3888/^\Eabc/ 3889 abc 3890 3891/^[\Eabc]/ 3892 a 3893\= Expect no match 3894 E 3895 3896/^[a-\Ec]/ 3897 b 3898\= Expect no match 3899 - 3900 E 3901 3902/^[a\E\E-\Ec]/ 3903 b 3904\= Expect no match 3905 - 3906 E 3907 3908/^[\E\Qa\E-\Qz\E]+/ 3909 b 3910\= Expect no match 3911 - 3912 3913/^[a\Q]bc\E]/ 3914 a 3915 ] 3916 c 3917 3918/^[a-\Q\E]/ 3919 a 3920 - 3921 3922/^(a()*)*/ 3923 aaaa 3924 3925/^(?:a(?:(?:))*)*/ 3926 aaaa 3927 3928/^(a()+)+/ 3929 aaaa 3930 3931/^(?:a(?:(?:))+)+/ 3932 aaaa 3933 3934/(a){0,3}(?(1)b|(c|))*D/ 3935 abbD 3936 ccccD 3937 D 3938 3939/(a|)*\d/ 3940 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 3941\= Expect no match 3942 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3943 3944/(?>a|)*\d/ 3945 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 3946\= Expect no match 3947 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3948 3949/(?:a|)*\d/ 3950 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4 3951\= Expect no match 3952 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3953 3954/\Z/g 3955 abc\n 3956 3957/^(?s)(?>.*)(?<!\n)/ 3958 abc 3959\= Expect no match 3960 abc\n 3961 3962/^(?![^\n]*\n\z)/ 3963 abc 3964\= Expect no match 3965 abc\n 3966 3967/\z(?<!\n)/ 3968 abc 3969\= Expect no match 3970 abc\n 3971 3972/(.*(.)?)*/ 3973 abcd 3974 3975/( (A | (?(1)0|) )* )/x 3976 abcd 3977 3978/( ( (?(1)0|) )* )/x 3979 abcd 3980 3981/( (?(1)0|)* )/x 3982 abcd 3983 3984/[[:abcd:xyz]]/ 3985 a] 3986 :] 3987 3988/[abc[:x\]pqr]/ 3989 a 3990 [ 3991 : 3992 ] 3993 p 3994 3995/.*[op][xyz]/ 3996\= Expect no match 3997 fooabcfoo 3998 3999/(?(?=.*b)b|^)/ 4000 adc 4001 abc 4002 4003/(?(?=^.*b)b|^)/ 4004 adc 4005\= Expect no match 4006 abc 4007 4008/(?(?=.*b)b|^)*/ 4009 adc 4010 abc 4011 4012/(?(?=.*b)b|^)+/ 4013 adc 4014 abc 4015 4016/(?(?=b).*b|^d)/ 4017 abc 4018 4019/(?(?=.*b).*b|^d)/ 4020 abc 4021 4022/^%((?(?=[a])[^%])|b)*%$/ 4023 %ab% 4024 4025/(?i)a(?-i)b|c/ 4026 XabX 4027 XAbX 4028 CcC 4029\= Expect no match 4030 XABX 4031 4032/[\x00-\xff\s]+/ 4033 \x0a\x0b\x0c\x0d 4034 4035/(abc)\1/i 4036\= Expect no match 4037 abc 4038 4039/(abc)\1/ 4040\= Expect no match 4041 abc 4042 4043/[^a]*/i 4044 12abc 4045 12ABC 4046 4047/[^a]*+/i 4048 12abc 4049 12ABC 4050 4051/[^a]*?X/i 4052\= Expect no match 4053 12abc 4054 12ABC 4055 4056/[^a]+?X/i 4057\= Expect no match 4058 12abc 4059 12ABC 4060 4061/[^a]?X/i 4062 12aXbcX 4063 12AXBCX 4064 BCX 4065 4066/[^a]??X/i 4067 12aXbcX 4068 12AXBCX 4069 BCX 4070 4071/[^a]?+X/i 4072 12aXbcX 4073 12AXBCX 4074 BCX 4075 4076/[^a]{2,3}/i 4077 abcdef 4078 ABCDEF 4079 4080/[^a]{2,3}?/i 4081 abcdef 4082 ABCDEF 4083 4084/[^a]{2,3}+/i 4085 abcdef 4086 ABCDEF 4087 4088/((a|)+)+Z/ 4089 Z 4090 4091/(a)b|(a)c/ 4092 ac 4093 4094/(?>(a))b|(a)c/ 4095 ac 4096 4097/(?=(a))ab|(a)c/ 4098 ac 4099 4100/((?>(a))b|(a)c)/ 4101 ac 4102 4103/((?>(a))b|(a)c)++/ 4104 ac 4105 4106/(?:(?>(a))b|(a)c)++/ 4107 ac 4108 4109/(?=(?>(a))b|(a)c)(..)/ 4110 ac 4111 4112/(?>(?>(a))b|(a)c)/ 4113 ac 4114 4115/(?:(?>([ab])))+a=/aftertext 4116 =ba= 4117 4118/(?>([ab]))+a=/aftertext 4119 =ba= 4120 4121/((?>(a+)b)+(aabab))/ 4122 aaaabaaabaabab 4123 4124/(?>a+|ab)+?c/ 4125\= Expect no match 4126 aabc 4127 4128/(?>a+|ab)+c/ 4129\= Expect no match 4130 aabc 4131 4132/(?:a+|ab)+c/ 4133 aabc 4134 4135/(?(?=(a))a)/ 4136 a 4137 4138/(?(?=(a))a)(b)/ 4139 ab 4140 4141/^(?:a|ab)++c/ 4142\= Expect no match 4143 aaaabc 4144 4145/^(?>a|ab)++c/ 4146\= Expect no match 4147 aaaabc 4148 4149/^(?:a|ab)+c/ 4150 aaaabc 4151 4152/(?=abc){3}abc/aftertext 4153 abcabcabc 4154\= Expect no match 4155 xyz 4156 4157/(?=abc)+abc/aftertext 4158 abcabcabc 4159\= Expect no match 4160 xyz 4161 4162/(?=abc)++abc/aftertext 4163 abcabcabc 4164\= Expect no match 4165 xyz 4166 4167/(?=abc){0}xyz/ 4168 xyz 4169 4170/(?=abc){1}xyz/ 4171\= Expect no match 4172 xyz 4173 4174/(?=(a))?./ 4175 ab 4176 bc 4177 4178/(?=(a))??./ 4179 ab 4180 bc 4181 4182/^(?=(?1))?[az]([abc])d/ 4183 abd 4184 zcdxx 4185 4186/^(?!a){0}\w+/ 4187 aaaaa 4188 4189/(?<=(abc))?xyz/ 4190 abcxyz 4191 pqrxyz 4192 4193/^[\g<a>]+/ 4194 ggg<<<aaa>>> 4195\= Expect no match 4196 \\ga 4197 4198/^[\ga]+/ 4199 gggagagaxyz 4200 4201/^[:a[:digit:]]+/ 4202 aaaa444:::Z 4203 4204/^[:a[:digit:]:b]+/ 4205 aaaa444:::bbbZ 4206 4207/[:a]xxx[b:]/ 4208 :xxx: 4209 4210/(?<=a{2})b/i 4211 xaabc 4212\= Expect no match 4213 xabc 4214 4215/(?<!a{2})b/i 4216 xabc 4217\= Expect no match 4218 xaabc 4219 4220/(?<=a\h)c/ 4221 xa c 4222 4223/(?<=[^a]{2})b/ 4224 axxbc 4225 aAAbc 4226\= Expect no match 4227 xaabc 4228 4229/(?<=[^a]{2})b/i 4230 axxbc 4231\= Expect no match 4232 aAAbc 4233 xaabc 4234 4235/(?<=a\H)c/ 4236 abc 4237 4238/(?<=a\V)c/ 4239 abc 4240 4241/(?<=a\v)c/ 4242 a\nc 4243 4244/(?(?=c)c|d)++Y/ 4245 XcccddYX 4246 4247/(?(?=c)c|d)*+Y/ 4248 XcccddYX 4249 4250/^(a{2,3}){2,}+a/ 4251 aaaaaaa 4252\= Expect no match 4253 aaaaaa 4254 aaaaaaaaa 4255 4256/^(a{2,3})++a/ 4257\= Expect no match 4258 aaaaaa 4259 4260/^(a{2,3})*+a/ 4261\= Expect no match 4262 aaaaaa 4263 4264/\H\h\V\v/ 4265 X X\x0a 4266 X\x09X\x0b 4267\= Expect no match 4268 \xa0 X\x0a 4269 4270/\H*\h+\V?\v{3,4}/ 4271 \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a 4272 \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a 4273 \x09\x20\xa0\x0a\x0b\x0c 4274\= Expect no match 4275 \x09\x20\xa0\x0a\x0b 4276 4277/\H{3,4}/ 4278 XY ABCDE 4279 XY PQR ST 4280 4281/.\h{3,4}./ 4282 XY AB PQRS 4283 4284/\h*X\h?\H+Y\H?Z/ 4285 >XNNNYZ 4286 > X NYQZ 4287\= Expect no match 4288 >XYZ 4289 > X NY Z 4290 4291/\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/ 4292 >XY\x0aZ\x0aA\x0bNN\x0c 4293 >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c 4294 4295/(foo)\Kbar/ 4296 foobar 4297 4298/(foo)(\Kbar|baz)/ 4299 foobar 4300 foobaz 4301 4302/(foo\Kbar)baz/ 4303 foobarbaz 4304 4305/abc\K|def\K/g,aftertext 4306 Xabcdefghi 4307 4308/ab\Kc|de\Kf/g,aftertext 4309 Xabcdefghi 4310 4311/(?=C)/g,aftertext 4312 ABCDECBA 4313 4314/^abc\K/aftertext 4315 abcdef 4316\= Expect no match 4317 defabcxyz 4318 4319/^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-2}Z/ 4320 ababababbbabZXXXX 4321 4322/(?<A>tom|bon)-\g{A}/ 4323 tom-tom 4324 bon-bon 4325 4326/(^(a|b\g{-1}))/ 4327\= Expect no match 4328 bacxxx 4329 4330/(?|(abc)|(xyz))\1/ 4331 abcabc 4332 xyzxyz 4333\= Expect no match 4334 abcxyz 4335 xyzabc 4336 4337/(?|(abc)|(xyz))(?1)/ 4338 abcabc 4339 xyzabc 4340\= Expect no match 4341 xyzxyz 4342 4343/^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/ 4344 XYabcdY 4345 4346/^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/ 4347 XYabcdY 4348 4349/^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/ 4350 XYabcdY 4351 4352/(?'abc'\w+):\k<abc>{2}/ 4353 a:aaxyz 4354 ab:ababxyz 4355\= Expect no match 4356 a:axyz 4357 ab:abxyz 4358 4359/(?'abc'\w+):\g{abc}{2}/ 4360 a:aaxyz 4361 ab:ababxyz 4362\= Expect no match 4363 a:axyz 4364 ab:abxyz 4365 4366/^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x 4367 abd 4368 ce 4369 4370/^(a.)\g-1Z/ 4371 aXaXZ 4372 4373/^(a.)\g{-1}Z/ 4374 aXaXZ 4375 4376/^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x 4377 abcd 4378 4379/(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT)) 4380 (?(DEFINE) 4381 (?<NAME_PAT>[a-z]+) 4382 (?<ADDRESS_PAT>\d+) 4383 )/x 4384 metcalfe 33 4385 4386/(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/ 4387 1.2.3.4 4388 131.111.10.206 4389 10.0.0.0 4390\= Expect no match 4391 10.6 4392 455.3.4.5 4393 4394/\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/ 4395 1.2.3.4 4396 131.111.10.206 4397 10.0.0.0 4398\= Expect no match 4399 10.6 4400 455.3.4.5 4401 4402/^(\w++|\s++)*$/ 4403 now is the time for all good men to come to the aid of the party 4404\= Expect no match 4405 this is not a line with only words and spaces! 4406 4407/(\d++)(\w)/ 4408 12345a 4409\= Expect no match 4410 12345+ 4411 4412/a++b/ 4413 aaab 4414 4415/(a++b)/ 4416 aaab 4417 4418/(a++)b/ 4419 aaab 4420 4421/([^()]++|\([^()]*\))+/ 4422 ((abc(ade)ufh()()x 4423 4424/\(([^()]++|\([^()]+\))+\)/ 4425 (abc) 4426 (abc(def)xyz) 4427\= Expect no match 4428 ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 4429 4430/^([^()]|\((?1)*\))*$/ 4431 abc 4432 a(b)c 4433 a(b(c))d 4434\= Expect no match) 4435 a(b(c)d 4436 4437/^>abc>([^()]|\((?1)*\))*<xyz<$/ 4438 >abc>123<xyz< 4439 >abc>1(2)3<xyz< 4440 >abc>(1(2)3)<xyz< 4441 4442/^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i 4443 1221 4444 Satanoscillatemymetallicsonatas 4445 AmanaplanacanalPanama 4446 AblewasIereIsawElba 4447\= Expect no match 4448 Thequickbrownfox 4449 4450/^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/ 4451 12 4452 (((2+2)*-3)-7) 4453 -12 4454\= Expect no match 4455 ((2+2)*-3)-7) 4456 4457/^(x(y|(?1){2})z)/ 4458 xyz 4459 xxyzxyzz 4460\= Expect no match 4461 xxyzz 4462 xxyzxyzxyzz 4463 4464/((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x 4465 <> 4466 <abcd> 4467 <abc <123> hij> 4468 <abc <def> hij> 4469 <abc<>def> 4470 <abc<> 4471\= Expect no match 4472 <abc 4473 4474/^a+(*FAIL)/ 4475\= Expect no match 4476 aaaaaa 4477 4478/a+b?c+(*FAIL)/ 4479\= Expect no match 4480 aaabccc 4481 4482/a+b?(*PRUNE)c+(*FAIL)/ 4483\= Expect no match 4484 aaabccc 4485 4486/a+b?(*COMMIT)c+(*FAIL)/ 4487\= Expect no match 4488 aaabccc 4489 4490/a+b?(*SKIP)c+(*FAIL)/ 4491\= Expect no match 4492 aaabcccaaabccc 4493 4494/^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/ 4495 aaaxxxxxx 4496 aaa++++++ 4497 bbbxxxxx 4498 bbb+++++ 4499 cccxxxx 4500 ccc++++ 4501 dddddddd 4502 4503/^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/ 4504 aaaxxxxxx 4505 aaa++++++ 4506 bbbxxxxx 4507 bbb+++++ 4508 cccxxxx 4509 ccc++++ 4510 dddddddd 4511 4512/a+b?(*THEN)c+(*FAIL)/ 4513\= Expect no match 4514 aaabccc 4515 4516/(A (A|B(*ACCEPT)|C) D)(E)/x 4517 AB 4518 ABX 4519 AADE 4520 ACDE 4521\= Expect no match 4522 AD 4523 4524/^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i 4525 1221 4526 Satan, oscillate my metallic sonatas! 4527 A man, a plan, a canal: Panama! 4528 Able was I ere I saw Elba. 4529\= Expect no match 4530 The quick brown fox 4531 4532/^((.)(?1)\2|.)$/ 4533 a 4534 aba 4535 aabaa 4536 abcdcba 4537 pqaabaaqp 4538 ablewasiereisawelba 4539\= Expect no match 4540 rhubarb 4541 the quick brown fox 4542 4543/(a)(?<=b(?1))/ 4544 baz 4545\= Expect no match 4546 caz 4547 4548/(?<=b(?1))(a)/ 4549 zbaaz 4550\= Expect no match 4551 aaa 4552 4553/(?<X>a)(?<=b(?&X))/ 4554 baz 4555 4556/^(?|(abc)|(def))\1/ 4557 abcabc 4558 defdef 4559\= Expect no match 4560 abcdef 4561 defabc 4562 4563/^(?|(abc)|(def))(?1)/ 4564 abcabc 4565 defabc 4566\= Expect no match 4567 defdef 4568 abcdef 4569 4570/(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/x,dupnames 4571 a\"aaaaa 4572 b\"aaaaa 4573\= Expect no match 4574 b\"11111 4575 4576/(?:(?1)|B)(A(*F)|C)/ 4577 ABCD 4578 CCD 4579\= Expect no match 4580 CAD 4581 4582/^(?:(?1)|B)(A(*F)|C)/ 4583 CCD 4584 BCD 4585\= Expect no match 4586 ABCD 4587 CAD 4588 BAD 4589 4590/(?:(?1)|B)(A(*ACCEPT)XX|C)D/ 4591 AAD 4592 ACD 4593 BAD 4594 BCD 4595 BAX 4596\= Expect no match 4597 ACX 4598 ABC 4599 4600/(?(DEFINE)(A))B(?1)C/ 4601 BAC 4602 4603/(?(DEFINE)((A)\2))B(?1)C/ 4604 BAAC 4605 4606/(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x 4607 (ab(cd)ef) 4608 4609/^(?=a(*SKIP)b|ac)/ 4610\= Expect no match 4611 ac 4612 4613/^(?=a(*PRUNE)b)/ 4614 ab 4615\= Expect no match 4616 ac 4617 4618/^(?=a(*ACCEPT)b)/ 4619 ac 4620 4621/(?>a\Kb)/ 4622 ab 4623 4624/((?>a\Kb))/ 4625 ab 4626 4627/(a\Kb)/ 4628 ab 4629 4630/^a\Kcz|ac/ 4631 ac 4632 4633/(?>a\Kbz|ab)/ 4634 ab 4635 4636/^(?&t)(?(DEFINE)(?<t>a\Kb))$/ 4637 ab 4638 4639/^([^()]|\((?1)*\))*$/ 4640 a(b)c 4641 a(b(c)d)e 4642 4643/(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/ 4644 0 4645 00 4646 0000 4647 4648/(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/ 4649 0 4650 00 4651 0000 4652 4653# This one does fail, as expected, in Perl. It needs the complex item at the 4654# end of the pattern. A single letter instead of (B|D) makes it not fail, which 4655# I think is a Perl bug. 4656 4657/A(*COMMIT)(B|D)/ 4658\= Expect no match 4659 ACABX 4660 4661# Check the use of names for failure 4662 4663/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/mark 4664\= Expect no match 4665 AC 4666 CB 4667 4668/(*MARK:A)(*SKIP:B)(C|X)/mark 4669 C 4670\= Expect no match 4671 D 4672 4673/^(A(*THEN:A)B|C(*THEN:B)D)/mark 4674\= Expect no match 4675 CB 4676 4677/^(?:A(*THEN:A)B|C(*THEN:B)D)/mark 4678\= Expect no match 4679 CB 4680 4681/^(?>A(*THEN:A)B|C(*THEN:B)D)/mark 4682\= Expect no match 4683 CB 4684 4685# This should succeed, as the skip causes bump to offset 1 (the mark). Note 4686# that we have to have something complicated such as (B|Z) at the end because, 4687# for Perl, a simple character somehow causes an unwanted optimization to mess 4688# with the handling of backtracking verbs. 4689 4690/A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/x,mark 4691 AAAC 4692 4693# Test skipping over a non-matching mark. 4694 4695/A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/x,mark 4696 AAAC 4697 4698# Check shorthand for MARK. 4699 4700/A(*:A)A+(*SKIP:A)(B|Z) | AC/x,mark 4701 AAAC 4702 4703/(*:A)A+(*SKIP:A)(B|Z)/mark 4704\= Expect no match 4705 AAAC 4706 4707# This should succeed, as a non-existent skip name disables the skip. 4708 4709/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/x,mark 4710 AAAC 4711 4712/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/x,mark 4713 AAAC 4714 4715# COMMIT at the start of a pattern should act like an anchor. Again, however, 4716# we need the complication for Perl. 4717 4718/(*COMMIT)(A|P)(B|P)(C|P)/ 4719 ABCDEFG 4720\= Expect no match 4721 DEFGABC 4722 4723# COMMIT inside an atomic group can't stop backtracking over the group. 4724 4725/(\w+)(?>b(*COMMIT))\w{2}/ 4726 abbb 4727 4728/(\w+)b(*COMMIT)\w{2}/ 4729\= Expect no match 4730 abbb 4731 4732# Check opening parens in comment when seeking forward reference. 4733 4734/(?&t)(?#()(?(DEFINE)(?<t>a))/ 4735 bac 4736 4737# COMMIT should override THEN. 4738 4739/(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/ 4740\= Expect no match 4741 yes 4742 4743/(?>(*COMMIT)(yes|no)(*THEN)(*F))?/ 4744\= Expect no match 4745 yes 4746 4747/b?(*SKIP)c/ 4748 bc 4749 abc 4750 4751/(*SKIP)bc/ 4752\= Expect no match 4753 a 4754 4755/(*SKIP)b/ 4756\= Expect no match 4757 a 4758 4759/(?P<abn>(?P=abn)xxx|)+/ 4760 xxx 4761 4762/(?i:([^b]))(?1)/ 4763 aa 4764 aA 4765\= Expect no match 4766 ab 4767 aB 4768 Ba 4769 ba 4770 4771/^(?&t)*+(?(DEFINE)(?<t>a))\w$/ 4772 aaaaaaX 4773\= Expect no match 4774 aaaaaa 4775 4776/^(?&t)*(?(DEFINE)(?<t>a))\w$/ 4777 aaaaaaX 4778 aaaaaa 4779 4780/^(a)*+(\w)/ 4781 aaaaX 4782 YZ 4783\= Expect no match 4784 aaaa 4785 4786/^(?:a)*+(\w)/ 4787 aaaaX 4788 YZ 4789\= Expect no match 4790 aaaa 4791 4792/^(a)++(\w)/ 4793 aaaaX 4794\= Expect no match 4795 aaaa 4796 YZ 4797 4798/^(?:a)++(\w)/ 4799 aaaaX 4800\= Expect no match 4801 aaaa 4802 YZ 4803 4804/^(a)?+(\w)/ 4805 aaaaX 4806 YZ 4807 4808/^(?:a)?+(\w)/ 4809 aaaaX 4810 YZ 4811 4812/^(a){2,}+(\w)/ 4813 aaaaX 4814\= Expect no match 4815 aaa 4816 YZ 4817 4818/^(?:a){2,}+(\w)/ 4819 aaaaX 4820\= Expect no match 4821 aaa 4822 YZ 4823 4824/(a|)*(?1)b/ 4825 b 4826 ab 4827 aab 4828 4829/(a)++(?1)b/ 4830\= Expect no match 4831 ab 4832 aab 4833 4834/(a)*+(?1)b/ 4835\= Expect no match 4836 ab 4837 aab 4838 4839/(?1)(?:(b)){0}/ 4840 b 4841 4842/(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x 4843 foo(bar(baz)+baz(bop)) 4844 4845/(A (A|B(*ACCEPT)|C) D)(E)/x 4846 AB 4847 4848/\A.*?(a|bc)/ 4849 ba 4850 4851/\A.*?(?:a|bc)++/ 4852 ba 4853 4854/\A.*?(a|bc)++/ 4855 ba 4856 4857/\A.*?(?:a|bc|d)/ 4858 ba 4859 4860/(?:(b))++/ 4861 beetle 4862 4863/(?(?=(a(*ACCEPT)z))a)/ 4864 a 4865 4866/^(a)(?1)+ab/ 4867 aaaab 4868 4869/^(a)(?1)++ab/ 4870\= Expect no match 4871 aaaab 4872 4873/^(?=a(*:M))aZ/mark 4874 aZbc 4875 4876/^(?!(*:M)b)aZ/mark 4877 aZbc 4878 4879/(?(DEFINE)(a))?b(?1)/ 4880 backgammon 4881 4882/^\N+/ 4883 abc\ndef 4884 4885/^\N{1,}/ 4886 abc\ndef 4887 4888/(?(R)a+|(?R)b)/ 4889 aaaabcde 4890 4891/(?(R)a+|((?R))b)/ 4892 aaaabcde 4893 4894/((?(R)a+|(?1)b))/ 4895 aaaabcde 4896 4897/((?(R1)a+|(?1)b))/ 4898 aaaabcde 4899 4900/((?(R)a|(?1)))*/ 4901 aaa 4902 4903/((?(R)a|(?1)))+/ 4904 aaa 4905 4906/a(*:any 4907name)/mark 4908 abc 4909 4910/(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/ 4911 a 4912 ba 4913 bba 4914 4915# Checking revised (*THEN) handling. 4916 4917# Capture 4918 4919/^.*? (a(*THEN)b) c/x 4920\= Expect no match 4921 aabc 4922 4923/^.*? (a(*THEN)b|(*F)) c/x 4924 aabc 4925 4926/^.*? ( (a(*THEN)b) | (*F) ) c/x 4927 aabc 4928 4929/^.*? ( (a(*THEN)b) ) c/x 4930\= Expect no match 4931 aabc 4932 4933# Non-capture 4934 4935/^.*? (?:a(*THEN)b) c/x 4936\= Expect no match 4937 aabc 4938 4939/^.*? (?:a(*THEN)b|(*F)) c/x 4940 aabc 4941 4942/^.*? (?: (?:a(*THEN)b) | (*F) ) c/x 4943 aabc 4944 4945/^.*? (?: (?:a(*THEN)b) ) c/x 4946\= Expect no match 4947 aabc 4948 4949# Atomic 4950 4951/^.*? (?>a(*THEN)b) c/x 4952\= Expect no match 4953 aabc 4954 4955/^.*? (?>a(*THEN)b|(*F)) c/x 4956 aabc 4957 4958/^.*? (?> (?>a(*THEN)b) | (*F) ) c/x 4959 aabc 4960 4961/^.*? (?> (?>a(*THEN)b) ) c/x 4962\= Expect no match 4963 aabc 4964 4965# Possessive capture 4966 4967/^.*? (a(*THEN)b)++ c/x 4968\= Expect no match 4969 aabc 4970 4971/^.*? (a(*THEN)b|(*F))++ c/x 4972 aabc 4973 4974/^.*? ( (a(*THEN)b)++ | (*F) )++ c/x 4975 aabc 4976 4977/^.*? ( (a(*THEN)b)++ )++ c/x 4978\= Expect no match 4979 aabc 4980 4981# Possessive non-capture 4982 4983/^.*? (?:a(*THEN)b)++ c/x 4984\= Expect no match 4985 aabc 4986 4987/^.*? (?:a(*THEN)b|(*F))++ c/x 4988 aabc 4989 4990/^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x 4991 aabc 4992 4993/^.*? (?: (?:a(*THEN)b)++ )++ c/x 4994\= Expect no match 4995 aabc 4996 4997# Condition assertion 4998 4999/^(?(?=a(*THEN)b)ab|ac)/ 5000 ac 5001 5002# Condition 5003 5004/^.*?(?(?=a)a|b(*THEN)c)/ 5005\= Expect no match 5006 ba 5007 5008/^.*?(?:(?(?=a)a|b(*THEN)c)|d)/ 5009 ba 5010 5011/^.*?(?(?=a)a(*THEN)b|c)/ 5012\= Expect no match 5013 ac 5014 5015# Assertion 5016 5017/^.*(?=a(*THEN)b)/ 5018 aabc 5019 5020# -------------------------- 5021 5022/(?>a(*:m))/imsx,mark 5023 a 5024 5025/(?>(a)(*:m))/imsx,mark 5026 a 5027 5028/(?<=a(*ACCEPT)b)c/ 5029 xacd 5030 5031/(?<=(a(*ACCEPT)b))c/ 5032 xacd 5033 5034/(?<=(a(*COMMIT)b))c/ 5035 xabcd 5036\= Expect no match 5037 xacd 5038 5039/(?<!a(*FAIL)b)c/ 5040 xcd 5041 acd 5042 5043/(?<=a(*:N)b)c/mark 5044 xabcd 5045 5046/(?<=a(*PRUNE)b)c/ 5047 xabcd 5048 5049/(?<=a(*SKIP)b)c/ 5050 xabcd 5051 5052/(?<=a(*THEN)b)c/ 5053 xabcd 5054 5055/(a)(?2){2}(.)/ 5056 abcd 5057 5058/(*MARK:A)(*PRUNE:B)(C|X)/mark 5059 C 5060\= Expect no match 5061 D 5062 5063/(*MARK:A)(*PRUNE:B)(C|X)/mark 5064 C 5065\= Expect no match 5066 D 5067 5068/(*MARK:A)(*THEN:B)(C|X)/mark 5069 C 5070\= Expect no match 5071 D 5072 5073/(*MARK:A)(*THEN:B)(C|X)/mark,no_start_optimize 5074 C 5075\= Expect no match 5076 D 5077 5078/(*MARK:A)(*THEN:B)(C|X)/mark 5079 C 5080\= Expect no match 5081 D 5082 5083# This should fail, as the skip causes a bump to offset 3 (the skip). 5084 5085/A(*MARK:A)A+(*SKIP)(B|Z) | AC/x,mark 5086\= Expect no match 5087 AAAC 5088 5089# Same 5090 5091/A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/x,mark 5092\= Expect no match 5093 AAAC 5094 5095/A(*:A)A+(*SKIP)(B|Z) | AC/x,mark 5096\= Expect no match 5097 AAAC 5098 5099# This should fail, as a null name is the same as no name. 5100 5101/A(*MARK:A)A+(*SKIP:)(B|Z) | AC/x,mark 5102\= Expect no match 5103 AAAC 5104 5105# A check on what happens after hitting a mark and them bumping along to 5106# something that does not even start. Perl reports tags after the failures 5107# here, though it does not when the individual letters are made into something 5108# more complicated. 5109 5110/A(*:A)B|XX(*:B)Y/mark 5111 AABC 5112 XXYZ 5113\= Expect no match 5114 XAQQ 5115 XAQQXZZ 5116 AXQQQ 5117 AXXQQQ 5118 5119/^(A(*THEN:A)B|C(*THEN:B)D)/mark 5120 AB 5121 CD 5122\= Expect no match 5123 AC 5124 CB 5125 5126/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/mark 5127 AB 5128 CD 5129\= Expect no match 5130 AC 5131 CB 5132 5133# An empty name does not pass back an empty string. It is the same as if no 5134# name were given. 5135 5136/^(A(*PRUNE:)B|C(*PRUNE:B)D)/mark 5137 AB 5138 CD 5139 5140# PRUNE goes to next bumpalong; COMMIT does not. 5141 5142/A(*PRUNE:A)B/mark 5143 ACAB 5144 5145# Mark names can be duplicated. 5146 5147/A(*:A)B|X(*:A)Y/mark 5148 AABC 5149 XXYZ 5150 5151/b(*:m)f|a(*:n)w/mark 5152 aw 5153\= Expect no match 5154 abc 5155 5156/b(*:m)f|aw/mark 5157 abaw 5158\= Expect no match 5159 abc 5160 abax 5161 5162/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/x,mark 5163 AAAC 5164 5165/(?=a(*MARK:A)b)..x/mark 5166 abxy 5167\= Expect no match 5168 abpq 5169 5170/(?=a(*MARK:A)b)..(*:Y)x/mark 5171 abxy 5172\= Expect no match 5173 abpq 5174 5175/(?=a(*PRUNE:A)b)..x/mark 5176 abxy 5177\= Expect no match 5178 abpq 5179 5180/(?=a(*PRUNE:A)b)..(*:Y)x/mark 5181 abxy 5182\= Expect no match 5183 abpq 5184 5185/(?=a(*THEN:A)b)..x/mark 5186 abxy 5187\= Expect no match 5188 abpq 5189 5190/(?=a(*THEN:A)b)..(*:Y)x/mark 5191 abxy 5192\= Expect no match 5193 abpq 5194 5195/(another)?(\1?)test/ 5196 hello world test 5197 5198/(another)?(\1+)test/ 5199\= Expect no match 5200 hello world test 5201 5202/(a(*COMMIT)b){0}a(?1)|aac/ 5203 aac 5204 5205/((?:a?)*)*c/ 5206 aac 5207 5208/((?>a?)*)*c/ 5209 aac 5210 5211/(?>.*?a)(?<=ba)/ 5212 aba 5213 5214/(?:.*?a)(?<=ba)/ 5215 aba 5216 5217/(?>.*?a)b/s 5218 aab 5219 5220/(?>.*?a)b/ 5221 aab 5222 5223/(?>^a)b/s 5224\= Expect no match 5225 aab 5226 5227/(?>.*?)(?<=(abcd)|(wxyz))/ 5228 alphabetabcd 5229 endingwxyz 5230 5231/(?>.*)(?<=(abcd)|(wxyz))/ 5232 alphabetabcd 5233 endingwxyz 5234 5235"(?>.*)foo" 5236\= Expect no match 5237 abcdfooxyz 5238 5239"(?>.*?)foo" 5240 abcdfooxyz 5241 5242/(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/ 5243 ac 5244 5245/(?:(a(*SKIP)b)){0}(?:(?1)|ac)/ 5246 ac 5247 5248/(?<=(*SKIP)ac)a/ 5249\= Expect no match 5250 aa 5251 5252/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/x,mark 5253 AAAC 5254 5255/a(*SKIP:m)x|ac(*:n)(*SKIP:n)d|ac/mark 5256 acacd 5257 5258/A(*SKIP:m)x|A(*SKIP:n)x|AB/mark 5259 AB 5260 5261/((*SKIP:r)d){0}a(*SKIP:m)x|ac(*:n)|ac/mark 5262 acacd 5263 5264# Tests that try to figure out how Perl works. My hypothesis is that the first 5265# verb that is backtracked onto is the one that acts. This seems to be the case 5266# almost all the time, but there is one exception that is perhaps a bug. 5267 5268# This matches "aaaac"; each PRUNE advances one character until the subject no 5269# longer starts with 5 'a's. 5270 5271/aaaaa(*PRUNE)b|a+c/ 5272 aaaaaac 5273 5274# Putting SKIP in front of PRUNE makes no difference, as it is never 5275# backtracked onto, whether or not it has a label. 5276 5277/aaaaa(*SKIP)(*PRUNE)b|a+c/ 5278 aaaaaac 5279 5280/aaaaa(*SKIP:N)(*PRUNE)b|a+c/ 5281 aaaaaac 5282 5283/aaaa(*:N)a(*SKIP:N)(*PRUNE)b|a+c/ 5284 aaaaaac 5285 5286# Putting THEN in front makes no difference. 5287 5288/aaaaa(*THEN)(*PRUNE)b|a+c/ 5289 aaaaaac 5290 5291# However, putting COMMIT in front of the prune changes it to "no match". I 5292# think this is inconsistent and possibly a bug. For the moment, running this 5293# test is moved out of the Perl-compatible file. 5294 5295/aaaaa(*COMMIT)(*PRUNE)b|a+c/ 5296 5297# OK, lets play the same game again using SKIP instead of PRUNE. 5298 5299# This matches "ac" because SKIP forces the next match to start on the 5300# sixth "a". 5301 5302/aaaaa(*SKIP)b|a+c/ 5303 aaaaaac 5304 5305# Putting PRUNE in front makes no difference. 5306 5307/aaaaa(*PRUNE)(*SKIP)b|a+c/ 5308 aaaaaac 5309 5310# Putting THEN in front makes no difference. 5311 5312/aaaaa(*THEN)(*SKIP)b|a+c/ 5313 aaaaaac 5314 5315# In this case, neither does COMMIT. This still matches "ac". 5316 5317/aaaaa(*COMMIT)(*SKIP)b|a+c/ 5318 aaaaaac 5319 5320# This gives "no match", as expected. 5321 5322/aaaaa(*COMMIT)b|a+c/ 5323\= Expect no match 5324 aaaaaac 5325 5326# ---- Tests using THEN ---- 5327 5328# This matches "aaaaaac", as expected. 5329 5330/aaaaa(*THEN)b|a+c/ 5331 aaaaaac 5332 5333# Putting SKIP in front makes no difference. 5334 5335/aaaaa(*SKIP)(*THEN)b|a+c/ 5336 aaaaaac 5337 5338# Putting PRUNE in front makes no difference. 5339 5340/aaaaa(*PRUNE)(*THEN)b|a+c/ 5341 aaaaaac 5342 5343# Putting COMMIT in front makes no difference. 5344 5345/aaaaa(*COMMIT)(*THEN)b|a+c/ 5346 aaaaaac 5347 5348# End of "priority" tests 5349 5350/aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/ 5351 aaaaaa 5352 5353/aaaaa(*:m)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/ 5354 aaaaaa 5355 5356/aaaaa(*:n)(*PRUNE:m)(*SKIP:m)m|a+/ 5357 aaaaaa 5358 5359/aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/ 5360 aaaaaa 5361 5362/a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/ 5363 aaaac 5364 5365/a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/ 5366 aaaac 5367 5368/aaa(*PRUNE:A)a(*SKIP:A)b|a+c/ 5369 aaaac 5370 5371/aaa(*MARK:A)a(*SKIP:A)b|a+c/ 5372 aaaac 5373 5374/a(*:m)a(*COMMIT)(*SKIP:m)b|a+c/mark 5375 aaaaaac 5376 5377/.?(a|b(*THEN)c)/ 5378 ba 5379 5380/(a(*COMMIT)b)c|abd/ 5381 abc 5382\= Expect no match 5383 abd 5384 5385/(?=a(*COMMIT)b)abc|abd/ 5386 abc 5387 abd 5388 5389/(?>a(*COMMIT)b)c|abd/ 5390 abc 5391 abd 5392 5393/a(?=b(*COMMIT)c)[^d]|abd/ 5394 abc 5395\= Expect no match 5396 abd 5397 5398/a(?=bc).|abd/ 5399 abd 5400 abc 5401 5402/a(?>b(*COMMIT)c)d|abd/ 5403\= Expect no match 5404 abceabd 5405 5406/a(?>bc)d|abd/ 5407 abceabd 5408 5409/(?>a(*COMMIT)b)c|abd/ 5410 abd 5411 5412/(?>a(*COMMIT)c)d|abd/ 5413\= Expect no match 5414 abd 5415 5416/((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/ 5417 ac 5418 5419# These tests were formerly in test 2, but changes in PCRE and Perl have 5420# made them compatible. 5421 5422/^(a)?(?(1)a|b)+$/ 5423\= Expect no match 5424 a 5425 5426/(?=a\Kb)ab/ 5427 ab 5428 5429/(?!a\Kb)ac/ 5430 ac 5431 5432/^abc(?<=b\Kc)d/ 5433 abcd 5434 5435/^abc(?<!b\Kq)d/ 5436 abcd 5437 5438/A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/x,mark 5439\= Expect no match 5440 AAAC 5441 5442/^((abc|abcx)(*THEN)y|abcd)/ 5443 abcd 5444\= Expect no match 5445 abcxy 5446 5447/^((yes|no)(*THEN)(*F))?/ 5448\= Expect no match 5449 yes 5450 5451/(A (.*) C? (*THEN) | A D) (*FAIL)/x 5452\= Expect no match 5453 AbcdCBefgBhiBqz 5454 5455/(A (.*) C? (*THEN) | A D) z/x 5456\= Expect no match 5457 AbcdCBefgBhiBqz 5458 5459/(A (.*) C? (*THEN) | A D) \s* (*FAIL)/x 5460\= Expect no match 5461 AbcdCBefgBhiBqz 5462 5463/(A (.*) C? (*THEN) | A D) \s* z/x 5464\= Expect no match 5465 AbcdCBefgBhiBqz 5466 5467/(A (.*) (?:C|) (*THEN) | A D) (*FAIL)/x 5468\= Expect no match 5469 AbcdCBefgBhiBqz 5470 5471/(A (.*) (?:C|) (*THEN) | A D) z/x 5472\= Expect no match 5473 AbcdCBefgBhiBqz 5474 5475/(A (.*) C{0,6} (*THEN) | A D) (*FAIL)/x 5476\= Expect no match 5477 AbcdCBefgBhiBqz 5478 5479/(A (.*) C{0,6} (*THEN) | A D) z/x 5480\= Expect no match 5481 AbcdCBefgBhiBqz 5482 5483/(A (.*) (CE){0,6} (*THEN) | A D) (*FAIL)/x 5484\= Expect no match 5485 AbcdCEBefgBhiBqz 5486 5487/(A (.*) (CE){0,6} (*THEN) | A D) z/x 5488\= Expect no match 5489 AbcdCEBefgBhiBqz 5490 5491/(A (.*) (CE*){0,6} (*THEN) | A D) (*FAIL)/x 5492\= Expect no match 5493 AbcdCBefgBhiBqz 5494 5495/(A (.*) (CE*){0,6} (*THEN) | A D) z/x 5496\= Expect no match 5497 AbcdCBefgBhiBqz 5498 5499/(?=a(*COMMIT)b|ac)ac|ac/ 5500\= Expect no match 5501 ac 5502 5503/(?=a(*COMMIT)b|(ac)) ac | (a)c/x 5504\= Expect no match 5505 ac 5506 5507# ---- 5508 5509/(?(?!b(*THEN)a)bn|bnn)/ 5510 bnn 5511 5512/(?!b(*SKIP)a)bn|bnn/ 5513 bnn 5514 5515/(?(?!b(*SKIP)a)bn|bnn)/ 5516 bnn 5517 5518/(?!b(*PRUNE)a)bn|bnn/ 5519 bnn 5520 5521/(?(?!b(*PRUNE)a)bn|bnn)/ 5522 bnn 5523 5524/(?!b(*COMMIT)a)bn|bnn/ 5525 bnn 5526 5527/(?(?!b(*COMMIT)a)bn|bnn)/ 5528 bnn 5529 5530/(?=b(*SKIP)a)bn|bnn/ 5531\= Expect no match 5532 bnn 5533 5534/(?=b(*THEN)a)bn|bnn/ 5535 bnn 5536 5537/^(?!a(*SKIP)b)/ 5538 ac 5539 5540/^(?!a(*SKIP)b)../ 5541 acd 5542 5543/(?!a(*SKIP)b)../ 5544 acd 5545 5546/^(?(?!a(*SKIP)b))/ 5547 ac 5548 5549/^(?!a(*PRUNE)b)../ 5550 acd 5551 5552/(?!a(*PRUNE)b)../ 5553 acd 5554 5555/(?!a(*COMMIT)b)ac|cd/ 5556 ac 5557 5558/\A.*?(?:a|bc)/ 5559 ba 5560 5561/^(A(*THEN)B|C(*THEN)D)/ 5562 CD 5563 5564/(*:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 5565 abc 5566 5567/(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 5568 abc 5569 5570/(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 5571 abc 5572 5573/(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/mark 5574 abc 5575 5576/^\d*\w{4}/ 5577 1234 5578\= Expect no match 5579 123 5580 5581/^[^b]*\w{4}/ 5582 aaaa 5583\= Expect no match 5584 aaa 5585 5586/^[^b]*\w{4}/i 5587 aaaa 5588\= Expect no match 5589 aaa 5590 5591/^a*\w{4}/ 5592 aaaa 5593\= Expect no match 5594 aaa 5595 5596/^a*\w{4}/i 5597 aaaa 5598\= Expect no match 5599 aaa 5600 5601/(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames 5602 foofoo 5603 barbar 5604 5605/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/dupnames 5606 AfooA 5607 AbarA 5608\= Expect no match 5609 Afoofoo 5610 Abarbar 5611 5612/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ 5613 1 IN SOA non-sp1 non-sp2( 5614 5615/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/x,dupnames 5616 Ax 5617 BAxy 5618 5619/^A\xZ/ 5620 A\0Z 5621 5622/^A\o{123}B/ 5623 A\123B 5624 5625/ ^ a + + b $ /x 5626 aaaab 5627 5628/ ^ a + #comment 5629 + b $ /x 5630 aaaab 5631 5632/ ^ a + #comment 5633 #comment 5634 + b $ /x 5635 aaaab 5636 5637/ ^ (?> a + ) b $ /x 5638 aaaab 5639 5640/ ^ ( a + ) + + \w $ /x 5641 aaaab 5642 5643/(?:a\Kb)*+/aftertext 5644 ababc 5645 5646/(?>a\Kb)*/aftertext 5647 ababc 5648 5649/(?:a\Kb)*/aftertext 5650 ababc 5651 5652/(a\Kb)*+/aftertext 5653 ababc 5654 5655/(a\Kb)*/aftertext 5656 ababc 5657 5658/(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/ 5659\= Expect no match 5660 acb 5661 5662'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' 5663 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 5664 5665'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' 5666 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 5667 5668'\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++' 5669 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 5670 5671'\A([^\"1]++|[\"2]([^\"3]*+|[\"4][\"5])*+[\"6])++' 5672 NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED 5673 5674/^\w+(?>\s*)(?<=\w)/ 5675 test test 5676 5677/(?P<same>a)(?P<same>b)/g,dupnames 5678 abbaba 5679 5680/(?P<same>a)(?P<same>b)(?P=same)/g,dupnames 5681 abbaba 5682 5683/(?P=same)?(?P<same>a)(?P<same>b)/g,dupnames 5684 abbaba 5685 5686/(?:(?P=same)?(?:(?P<same>a)|(?P<same>b))(?P=same))+/g,dupnames 5687 bbbaaabaabb 5688 5689/(?:(?P=same)?(?:(?P=same)(?P<same>a)(?P=same)|(?P=same)?(?P<same>b)(?P=same)){2}(?P=same)(?P<same>c)(?P=same)){2}(?P<same>z)?/g,dupnames 5690\= Expect no match 5691 bbbaaaccccaaabbbcc 5692 5693/(?P<Name>a)?(?P<Name2>b)?(?(<Name>)c|d)*l/ 5694 acl 5695 bdl 5696 adl 5697 bcl 5698 5699/\sabc/ 5700 \x{0b}abc 5701 5702/[\Qa]\E]+/ 5703 aa]] 5704 5705/[\Q]a\E]+/ 5706 aa]] 5707 5708/A((((((((a))))))))\8B/ 5709 AaaB 5710 5711/A(((((((((a)))))))))\9B/ 5712 AaaB 5713 5714/A[\8\9]B/ 5715 A8B 5716 A9B 5717 5718/(|ab)*?d/ 5719 abd 5720 xyd 5721 5722/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/ 5723 1234abcd 5724 5725/(\2|a)(\1)/ 5726 aaa 5727 5728/(\2)(\1)/ 5729 5730"Z*(|d*){216}" 5731 5732"(?1)(?#?'){8}(a)" 5733 baaaaaaaaac 5734 5735/((((((((((((x))))))))))))\12/ 5736 xx 5737 5738/A[\8]B[\9]C/ 5739 A8B9C 5740 5741/(?1)()((((((\1++))\x85)+)|))/ 5742 \x85\x85 5743 5744"(?|(\k'Pm')|(?'Pm'))" 5745 abcd 5746 5747/(?|(aaa)|(b))\g{1}/ 5748 aaaaaa 5749 bb 5750 5751/(?|(aaa)|(b))(?1)/ 5752 aaaaaa 5753 baaa 5754\= Expect no match 5755 bb 5756 5757/(?|(aaa)|(b))/ 5758 xaaa 5759 xbc 5760 5761/(?|(?'a'aaa)|(?'a'b))\k'a'/ 5762 aaaaaa 5763 bb 5764 5765/(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/dupnames 5766 aaaccccaaa 5767 bccccb 5768 5769# /x does not apply to MARK labels 5770 5771/x (*MARK:ab cd # comment 5772ef) x/x,mark 5773 axxz 5774 5775/(?<=a(B){0}c)X/ 5776 acX 5777 5778/(?<DEFINE>b)(?(DEFINE)(a+))(?&DEFINE)/ 5779 bbbb 5780\= Expect no match 5781 baaab 5782 5783/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[,;:])(?=.{8,16})(?!.*[\s])/ 5784 \ Fred:099 5785 5786/(?=.*X)X$/ 5787 \ X 5788 5789/(?s)(?=.*?)b/ 5790 aabc 5791 5792/(Z)(a)\2{1,2}?(?-i)\1X/i 5793 ZaAAZX 5794 5795/(?'c')XX(?'YYYYYYYYYYYYYYYYYYYYYYYCl')/ 5796 5797/[s[:digit:]\E-H]+/ 5798 s09-H 5799 5800/[s[:digit:]\Q\E-H]+/ 5801 s09-H 5802 5803/a+(?:|b)a/ 5804 aaaa 5805 5806/X?(R||){3335}/ 5807 5808/(?1)(A(*COMMIT)|B)D/ 5809 ABD 5810 XABD 5811 BAD 5812 ABXABD 5813\= Expect no match 5814 ABX 5815 5816/(?(DEFINE)(?<m> 1? (?=(?<cond>2)?) 1 2 (?('cond')|3))) 5817 \A 5818 () 5819 (?&m) 5820 \Z/x 5821 123 5822 5823/^(?: 5824(?: A| (1? (?=(?<cond>2)?) (1) 2 (?('cond')|3)) ) 5825(Z) 5826)+$/x 5827 AZ123Z 5828\= Expect no match 5829 AZ12Z 5830 5831/^ (?(DEFINE) ( (?!(a)\2b)..) ) ()(?1) /x 5832 acb 5833\= Expect no match 5834 aab 5835 5836'(?>ab|abab){1,5}?M' 5837 abababababababababababM 5838 5839'(?>ab|abab){2}?M' 5840 abababM 5841 5842'((?(?=(a))a)+k)' 5843 bbak 5844 5845'((?(?=(a))a|)+k)' 5846 bbak 5847 5848'(?(?!(b))a|b)+k' 5849 ababbalbbadabak 5850 5851/(?!(b))c|b/ 5852 Ab 5853 Ac 5854 5855/(?=(b))b|c/ 5856 Ab 5857 Ac 5858 5859/^(.|(.)(?1)\2)$/ 5860 a 5861 aba 5862 abcba 5863 ababa 5864 abcdcba 5865 5866/^((.)(?1)\2|.?)$/ 5867 a 5868 aba 5869 abba 5870 abcba 5871 ababa 5872 abccba 5873 abcdcba 5874 abcddcba 5875 5876/^(.)(\1|a(?2))/ 5877 bab 5878 5879/^(.|(.)(?1)?\2)$/ 5880 abcba 5881 5882/^(?(?=(a))abc|def)/ 5883 abc 5884 5885/^(?(?!(a))def|abc)/ 5886 abc 5887 5888/^(?(?=(a)(*ACCEPT))abc|def)/ 5889 abc 5890 5891/^(?(?!(a)(*ACCEPT))def|abc)/ 5892 abc 5893 5894/^(?1)\d{3}(a)/ 5895 a123a 5896 5897# This pattern uses a lot of named subpatterns in order to match email 5898# addresses in various formats. It's a heavy test for named subpatterns. In the 5899# <atext> group, slash is coded as \x{2f} so that this pattern can also be 5900# processed by perltest.sh, which does not cater for an escaped delimiter 5901# within the pattern. $ within the pattern must also be escaped. All $ and @ 5902# characters in subject strings are escaped so that Perl doesn't interpret them 5903# as variable insertions and " characters must also be escaped for Perl. 5904 5905# This set of subpatterns is more or less a direct transliteration of the BNF 5906# definitions in RFC2822, without any of the obsolete features. The addition of 5907# a possessive + to the definition of <phrase> reduced the match limit in PCRE2 5908# from over 5 million to just under 400, and eliminated a very noticeable delay 5909# when this file was passed to perltest.sh. 5910 5911/(?ix)(?(DEFINE) 5912(?<addr_spec> (?&local_part) \@ (?&domain) ) 5913(?<angle_addr> (?&CFWS)?+ < (?&addr_spec) > (?&CFWS)?+ ) 5914(?<atext> [a-z\d!#\$%&'*+-\x{2f}=?^_`{|}~] ) 5915(?<atom> (?&CFWS)?+ (?&atext)+ (?&CFWS)?+ ) 5916(?<ccontent> (?&ctext) | (?"ed_pair) | (?&comment) ) 5917(?<ctext> [^\x{9}\x{10}\x{13}\x{7f}-\x{ff}\ ()\\] ) 5918(?<comment> \( (?: (?&FWS)?+ (?&ccontent) )*+ (?&FWS)?+ \) ) 5919(?<CFWS> (?: (?&FWS)?+ (?&comment) )* (?# NOT possessive) 5920 (?: (?&FWS)?+ (?&comment) | (?&FWS) ) ) 5921(?<dcontent> (?&dtext) | (?"ed_pair) ) 5922(?<display_name> (?&phrase) ) 5923(?<domain> (?&dot_atom) | (?&domain_literal) ) 5924(?<domain_literal> (?&CFWS)?+ \[ (?: (?&FWS)?+ (?&dcontent) )* (?&FWS)?+ \] 5925 (?&CFWS)?+ ) 5926(?<dot_atom> (?&CFWS)?+ (?&dot_atom_text) (?&CFWS)?+ ) 5927(?<dot_atom_text> (?&atext)++ (?: \. (?&atext)++)*+ ) 5928(?<dtext> [^\x{9}\x{10}\x{13}\x{7f}-\x{ff}\ \[\]\\] ) 5929(?<FWS> (?: [\t\ ]*+ \n)?+ [\t\ ]++ ) 5930(?<local_part> (?&dot_atom) | (?"ed_string) ) 5931(?<mailbox> (?&name_addr) | (?&addr_spec) ) 5932(?<name_addr> (?&display_name)? (?&angle_addr) ) 5933(?<phrase> (?&word)++ ) 5934(?<qcontent> (?&qtext) | (?"ed_pair) ) 5935(?<quoted_pair> " (?&text) ) 5936(?<quoted_string> (?&CFWS)?+ " (?: (?&FWS)?+ (?&qcontent))* (?&FWS)?+ " 5937 (?&CFWS)?+ ) 5938(?<qtext> [^\x{9}\x{10}\x{13}\x{7f}-\x{ff}\ "\\] ) 5939(?<text> [^\r\n] ) 5940(?<word> (?&atom) | (?"ed_string) ) 5941) # End DEFINE 5942^(?&mailbox)$/ 5943 Alan Other <user\@dom.ain> 5944 <user\@dom.ain> 5945 user\@dom.ain 5946 user\@[] 5947 user\@[domain literal] 5948 user\@[domain literal with \"[square brackets\"] inside] 5949 \"A. Other\" <user.1234\@dom.ain> (a comment) 5950 A. Other <user.1234\@dom.ain> (a comment) 5951 \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay 5952\= Expect no match 5953 A missing angle <user\@some.where 5954 The quick brown fox 5955 5956# -------------------------------------------------------------------------- 5957 5958# This pattern uses named groups to match default PCRE2 patterns. It's another 5959# heavy test for named subpatterns. Once again, code slash as \x{2f} and escape 5960# $ even in classes so that this works with pcre2test. 5961 5962/(?sx)(?(DEFINE) 5963 5964(?<assertion> (?&simple_assertion) | (?&lookaround) ) 5965 5966(?<atomic_group> \( \? > (?®ex) \) ) 5967 5968(?<back_reference> \\ \d+ | 5969 \\g (?: [+-]?\d+ | \{ (?: [+-]?\d+ | (?&groupname) ) \} ) | 5970 \\k <(?&groupname)> | 5971 \\k '(?&groupname)' | 5972 \\k \{ (?&groupname) \} | 5973 \( \? P= (?&groupname) \) ) 5974 5975(?<branch> (?:(?&assertion) | 5976 (?&callout) | 5977 (?&comment) | 5978 (?&option_setting) | 5979 (?&qualified_item) | 5980 (?"ed_string) | 5981 (?"ed_string_empty) | 5982 (?&special_escape) | 5983 (?&verb) 5984 )* ) 5985 5986(?<callout> \(\?C (?: \d+ | 5987 (?: (?<D>["'`^%\#\$]) 5988 (?: \k'D'\k'D' | (?!\k'D') . )* \k'D' | 5989 \{ (?: \}\} | [^}]*+ )* \} ) 5990 )? \) ) 5991 5992(?<capturing_group> \( (?: \? P? < (?&groupname) > | \? ' (?&groupname) ' )? 5993 (?®ex) \) ) 5994 5995(?<character_class> \[ \^?+ (?: \] (?&class_item)* | (?&class_item)+ ) \] ) 5996 5997(?<character_type> (?! \\N\{\w+\} ) \\ [dDsSwWhHvVRN] ) 5998 5999(?<class_item> (?: \[ : (?: 6000 alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print| 6001 punct|space|upper|word|xdigit 6002 ) : \] | 6003 (?"ed_string) | 6004 (?"ed_string_empty) | 6005 (?&escaped_character) | 6006 (?&character_type) | 6007 [^]] ) ) 6008 6009(?<comment> \(\?\# [^)]* \) | (?"ed_string_empty) | \\E ) 6010 6011(?<condition> (?: \( [+-]? \d+ \) | 6012 \( < (?&groupname) > \) | 6013 \( ' (?&groupname) ' \) | 6014 \( R \d* \) | 6015 \( R & (?&groupname) \) | 6016 \( (?&groupname) \) | 6017 \( DEFINE \) | 6018 \( VERSION >?=\d+(?:\.\d\d?)? \) | 6019 (?&callout)?+ (?&comment)* (?&lookaround) ) ) 6020 6021(?<conditional_group> \(\? (?&condition) (?&branch) (?: \| (?&branch) )? \) ) 6022 6023(?<delimited_regex> (?<delimiter> [-\x{2f}!"'`=_:;,%&@~]) (?®ex) 6024 \k'delimiter' .* ) 6025 6026(?<escaped_character> \\ (?: 0[0-7]{1,2} | [0-7]{1,3} | o\{ [0-7]+ \} | 6027 x \{ (*COMMIT) [[:xdigit:]]* \} | x [[:xdigit:]]{0,2} | 6028 [aefnrt] | c[[:print:]] | 6029 [^[:alnum:]] ) ) 6030 6031(?<group> (?&capturing_group) | (?&non_capturing_group) | 6032 (?&resetting_group) | (?&atomic_group) | 6033 (?&conditional_group) ) 6034 6035(?<groupname> [a-zA-Z_]\w* ) 6036 6037(?<literal_character> (?! (?&range_qualifier) ) [^[()|*+?.\$\\] ) 6038 6039(?<lookaround> \(\? (?: = | ! | <= | <! ) (?®ex) \) ) 6040 6041(?<non_capturing_group> \(\? [iJmnsUx-]* : (?®ex) \) ) 6042 6043(?<option_setting> \(\? [iJmnsUx-]* \) ) 6044 6045(?<qualified_item> (?:\. | 6046 (?&lookaround) | 6047 (?&back_reference) | 6048 (?&character_class) | 6049 (?&character_type) | 6050 (?&escaped_character) | 6051 (?&group) | 6052 (?&subroutine_call) | 6053 (?&literal_character) | 6054 (?"ed_string) 6055 ) (?&comment)? (?&qualifier)? ) 6056 6057(?<qualifier> (?: [?*+] | (?&range_qualifier) ) [+?]? ) 6058 6059(?<quoted_string> (?: \\Q (?: (?!\\E | \k'delimiter') . )++ (?: \\E | ) ) ) 6060 6061(?<quoted_string_empty> \\Q\\E ) 6062 6063(?<range_qualifier> \{ (?: \d+ (?: , \d* )? | , \d+ ) \} ) 6064 6065(?<regex> (?&start_item)* (?&branch) (?: \| (?&branch) )* ) 6066 6067(?<resetting_group> \( \? \| (?®ex) \) ) 6068 6069(?<simple_assertion> \^ | \$ | \\A | \\b | \\B | \\G | \\z | \\Z ) 6070 6071(?<special_escape> \\K ) 6072 6073(?<start_item> \( \* (?: 6074 ANY | 6075 ANYCRLF | 6076 BSR_ANYCRLF | 6077 BSR_UNICODE | 6078 CR | 6079 CRLF | 6080 LF | 6081 LIMIT_MATCH=\d+ | 6082 LIMIT_DEPTH=\d+ | 6083 LIMIT_HEAP=\d+ | 6084 NOTEMPTY | 6085 NOTEMPTY_ATSTART | 6086 NO_AUTO_POSSESS | 6087 NO_DOTSTAR_ANCHOR | 6088 NO_JIT | 6089 NO_START_OPT | 6090 NUL | 6091 UTF | 6092 UCP ) \) ) 6093 6094(?<subroutine_call> (?: \(\?R\) | \(\?[+-]?\d+\) | 6095 \(\? (?: & | P> ) (?&groupname) \) | 6096 \\g < (?&groupname) > | 6097 \\g ' (?&groupname) ' | 6098 \\g < [+-]? \d+ > | 6099 \\g ' [+-]? \d+ ) ) 6100 6101(?<verb> \(\* (?: ACCEPT | FAIL | F | COMMIT | 6102 (?:MARK)?:(?&verbname) | 6103 (?:PRUNE|SKIP|THEN) (?: : (?&verbname)? )? ) \) ) 6104 6105(?<verbname> [^)]+ ) 6106 6107) # End DEFINE 6108# Kick it all off... 6109^(?&delimited_regex)$/subject_literal,jitstack=256 6110 /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/ 6111 /(cat(a(ract|tonic)|erpillar)) \1()2(3)/ 6112 /^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]/ 6113 /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/ 6114 /<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>/is 6115 /^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) / 6116 /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/ 6117 /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/ 6118 /^(\w++|\s++)*$/ 6119 /a+b?(*THEN)c+(*FAIL)/ 6120 /(A (A|B(*ACCEPT)|C) D)(E)/x 6121 /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i 6122 /A(*PRUNE)B(*SKIP)C(*THEN)D(*COMMIT)E(*F)F(*FAIL)G(?!)H(*ACCEPT)I/B 6123 /(?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 6124 /(?sx)(?(DEFINE)(?<assertion> (?&simple_assertion) | (?&lookaround) )(?<atomic_group> \( \? > (?®ex) \) )(?<back_reference> \\ \d+ | \\g (?: [+-]?\d+ | \{ (?: [+-]?\d+ | (?&groupname) ) \} ) | \\k <(?&groupname)> | \\k '(?&groupname)' | \\k \{ (?&groupname) \} | \( \? P= (?&groupname) \) )(?<branch> (?:(?&assertion) | (?&callout) | (?&comment) | (?&option_setting) | (?&qualified_item) | (?"ed_string) | (?"ed_string_empty) | (?&special_escape) | (?&verb) )* )(?<callout> \(\?C (?: \d+ | (?: (?<D>["'`^%\#\$]) (?: \k'D'\k'D' | (?!\k'D') . )* \k'D' | \{ (?: \}\} | [^}]*+ )* \} ) )? \) )(?<capturing_group> \( (?: \? P? < (?&groupname) > | \? ' (?&groupname) ' )? (?®ex) \) )(?<character_class> \[ \^?+ (?: \] (?&class_item)* | (?&class_item)+ ) \] )(?<character_type> (?! \\N\{\w+\} ) \\ [dDsSwWhHvVRN] )(?<class_item> (?: \[ : (?: alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print| punct|space|upper|word|xdigit ) : \] | (?"ed_string) | (?"ed_string_empty) | (?&escaped_character) | (?&character_type) | [^]] ) )(?<comment> \(\?\# [^)]* \) | (?"ed_string_empty) | \\E )(?<condition> (?: \( [+-]? \d+ \) | \( < (?&groupname) > \) | \( ' (?&groupname) ' \) | \( R \d* \) | \( R & (?&groupname) \) | \( (?&groupname) \) | \( DEFINE \) | \( VERSION >?=\d+(?:\.\d\d?)? \) | (?&callout)?+ (?&comment)* (?&lookaround) ) )(?<conditional_group> \(\? (?&condition) (?&branch) (?: \| (?&branch) )? \) )(?<delimited_regex> (?<delimiter> [-\x{2f}!"'`=_:;,%&@~]) (?®ex) \k'delimiter' .* )(?<escaped_character> \\ (?: 0[0-7]{1,2} | [0-7]{1,3} | o\{ [0-7]+ \} | x \{ (*COMMIT) [[:xdigit:]]* \} | x [[:xdigit:]]{0,2} | [aefnrt] | c[[:print:]] | [^[:alnum:]] ) )(?<group> (?&capturing_group) | (?&non_capturing_group) | (?&resetting_group) | (?&atomic_group) | (?&conditional_group) )(?<groupname> [a-zA-Z_]\w* )(?<literal_character> (?! (?&range_qualifier) ) [^[()|*+?.\$\\] )(?<lookaround> \(\? (?: = | ! | <= | <! ) (?®ex) \) )(?<non_capturing_group> \(\? [iJmnsUx-]* : (?®ex) \) )(?<option_setting> \(\? [iJmnsUx-]* \) )(?<qualified_item> (?:\. | (?&lookaround) | (?&back_reference) | (?&character_class) | (?&character_type) | (?&escaped_character) | (?&group) | (?&subroutine_call) | (?&literal_character) | (?"ed_string) ) (?&comment)? (?&qualifier)? )(?<qualifier> (?: [?*+] | (?&range_qualifier) ) [+?]? )(?<quoted_string> (?: \\Q (?: (?!\\E | \k'delimiter') . )++ (?: \\E | ) ) ) (?<quoted_string_empty> \\Q\\E ) (?<range_qualifier> \{ (?: \d+ (?: , \d* )? | , \d+ ) \} )(?<regex> (?&start_item)* (?&branch) (?: \| (?&branch) )* )(?<resetting_group> \( \? \| (?®ex) \) )(?<simple_assertion> \^ | \$ | \\A | \\b | \\B | \\G | \\z | \\Z )(?<special_escape> \\K )(?<start_item> \( \* (?: ANY | ANYCRLF | BSR_ANYCRLF | BSR_UNICODE | CR | CRLF | LF | LIMIT_MATCH=\d+ | LIMIT_DEPTH=\d+ | LIMIT_HEAP=\d+ | NOTEMPTY | NOTEMPTY_ATSTART | NO_AUTO_POSSESS | NO_DOTSTAR_ANCHOR | NO_JIT | NO_START_OPT | NUL | UTF | UCP ) \) )(?<subroutine_call> (?: \(\?R\) | \(\?[+-]?\d+\) | \(\? (?: & | P> ) (?&groupname) \) | \\g < (?&groupname) > | \\g ' (?&groupname) ' | \\g < [+-]? \d+ > | \\g ' [+-]? \d+ ) )(?<verb> \(\* (?: ACCEPT | FAIL | F | COMMIT | (?:MARK)?:(?&verbname) | (?:PRUNE|SKIP|THEN) (?: : (?&verbname)? )? ) \) )(?<verbname> [^)]+ ))^(?&delimited_regex)$/ 6125\= Expect no match 6126 /((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/ 6127 /(?:(?(2y)a|b)(X))+/ 6128 /a(*MARK)b/ 6129 /a(*CR)b/ 6130 /(?P<abn>(?P=abn)(?<badstufxxx)/ 6131 6132# -------------------------------------------------------------------------- 6133 6134/<(?x:[a b])>/xx 6135 < > 6136 6137/<(?:[a b])>/xx 6138 < > 6139 6140/<(?xxx:[a b])>/ 6141 < > 6142 6143/<(?-x:[a b])>/xx 6144 < > 6145 6146/[[:digit:]-]+/ 6147 12-24 6148 6149/((?<=((*ACCEPT)) )\1?\b) / 6150\= Expect no match 6151 ((?<=((*ACCEPT)) )\\1?\\b)\x20 6152 6153/((?<=((*ACCEPT))X)\1?Y)\1/ 6154 XYYZ 6155 6156/((?<=((*ACCEPT))X)\1?Y(*ACCEPT))\1/ 6157 XYYZ 6158 6159/(?(DEFINE)(?<optional_a>a?)X)^(?&optional_a)a$/ 6160 aa 6161 a 6162 6163/^(a?)b(?1)a/ 6164 abaa 6165 aba 6166 baa 6167 ba 6168 6169/^(a?)+b(?1)a/ 6170 abaa 6171 aba 6172 baa 6173 ba 6174 6175/^(a?)++b(?1)a/ 6176 abaa 6177 aba 6178 baa 6179 ba 6180 6181/^(a?)+b/ 6182 b 6183 ab 6184 aaab 6185 6186/(?=a+)a(a+)++b/ 6187 aab 6188 6189/(?<=\G.)/g,aftertext 6190 abc 6191 6192/(?<=(?=.)?)/ 6193 6194/(?<=(?=.)?+)/ 6195 6196/(?<=(?=.)*)/ 6197 6198/(?<=(?=.){4,5})/ 6199 6200/(?<=(?=.){4,5}x)/ 6201 6202/a(?=.(*:X))(*SKIP:X)(*F)|(.)/ 6203 abc 6204 6205/a(?>(*:X))(*SKIP:X)(*F)|(.)/ 6206 abc 6207 6208/a(?:(*:X))(*SKIP:X)(*F)|(.)/ 6209 abc 6210 6211#pattern no_start_optimize 6212 6213/(?>a(*:1))(?>b(*:1))(*SKIP:1)x|.*/ 6214 abc 6215 6216/(?>a(*:1))(?>b)(*SKIP:1)x|.*/ 6217 abc 6218 6219#subject mark 6220 6221/a(*ACCEPT:X)b/ 6222 abc 6223 6224/(?=a(*ACCEPT:QQ)bc)axyz/ 6225 axyz 6226 6227/(?(DEFINE)(a(*ACCEPT:X)))(?1)b/ 6228 abc 6229 6230/a(*F:X)b/ 6231 abc 6232 6233/(?(DEFINE)(a(*F:X)))(?1)b/ 6234 abc 6235 6236/a(*COMMIT:X)b/ 6237 abc 6238 6239/(?(DEFINE)(a(*COMMIT:X)))(?1)b/ 6240 abc 6241 6242/a+(*:Z)b(*COMMIT:X)(*SKIP:Z)c|.*/ 6243 aaaabd 6244 6245/a+(*:Z)b(*COMMIT:X)(*SKIP:X)c|.*/ 6246 aaaabd 6247 6248/a(*COMMIT:X)b/ 6249 axabc 6250 6251#pattern -no_start_optimize 6252#subject -mark 6253 6254/(.COMMIT)(*COMMIT::::::::::interal error:::)/ 6255 6256/(*COMMIT:��)/ 6257 6258/(*COMMIT:]w)/ 6259 6260/(?i)A(?^)B(?^x:C D)(?^i)e f/ 6261 aBCDE F 6262\= Expect no match 6263 aBCDEF 6264 AbCDe f 6265 6266# End of testinput1 6267