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