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