upload tomcat
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / native / iis / pcre / testdata / testinput1
1 /the quick brown fox/
2     the quick brown fox
3     The quick brown FOX
4     What do you know about the quick brown fox?
5     What do you know about THE QUICK BROWN FOX?
6
7 /The quick brown fox/i
8     the quick brown fox
9     The quick brown FOX
10     What do you know about the quick brown fox?
11     What do you know about THE QUICK BROWN FOX?
12
13 /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
14     abcd\t\n\r\f\a\e9;\$\\?caxyz
15
16 /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
17     abxyzpqrrrabbxyyyypqAzz
18     abxyzpqrrrabbxyyyypqAzz
19     aabxyzpqrrrabbxyyyypqAzz
20     aaabxyzpqrrrabbxyyyypqAzz
21     aaaabxyzpqrrrabbxyyyypqAzz
22     abcxyzpqrrrabbxyyyypqAzz
23     aabcxyzpqrrrabbxyyyypqAzz
24     aaabcxyzpqrrrabbxyyyypAzz
25     aaabcxyzpqrrrabbxyyyypqAzz
26     aaabcxyzpqrrrabbxyyyypqqAzz
27     aaabcxyzpqrrrabbxyyyypqqqAzz
28     aaabcxyzpqrrrabbxyyyypqqqqAzz
29     aaabcxyzpqrrrabbxyyyypqqqqqAzz
30     aaabcxyzpqrrrabbxyyyypqqqqqqAzz
31     aaaabcxyzpqrrrabbxyyyypqAzz
32     abxyzzpqrrrabbxyyyypqAzz
33     aabxyzzzpqrrrabbxyyyypqAzz
34     aaabxyzzzzpqrrrabbxyyyypqAzz
35     aaaabxyzzzzpqrrrabbxyyyypqAzz
36     abcxyzzpqrrrabbxyyyypqAzz
37     aabcxyzzzpqrrrabbxyyyypqAzz
38     aaabcxyzzzzpqrrrabbxyyyypqAzz
39     aaaabcxyzzzzpqrrrabbxyyyypqAzz
40     aaaabcxyzzzzpqrrrabbbxyyyypqAzz
41     aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
42     aaabcxyzpqrrrabbxyyyypABzz
43     aaabcxyzpqrrrabbxyyyypABBzz
44     >>>aaabxyzpqrrrabbxyyyypqAzz
45     >aaaabxyzpqrrrabbxyyyypqAzz
46     >>>>abcxyzpqrrrabbxyyyypqAzz
47     *** Failers
48     abxyzpqrrabbxyyyypqAzz
49     abxyzpqrrrrabbxyyyypqAzz
50     abxyzpqrrrabxyyyypqAzz
51     aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
52     aaaabcxyzzzzpqrrrabbbxyyypqAzz
53     aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
54
55 /^(abc){1,2}zz/
56     abczz
57     abcabczz
58     *** Failers
59     zz
60     abcabcabczz
61     >>abczz
62
63 /^(b+?|a){1,2}?c/
64     bc
65     bbc
66     bbbc
67     bac
68     bbac
69     aac
70     abbbbbbbbbbbc
71     bbbbbbbbbbbac
72     *** Failers
73     aaac
74     abbbbbbbbbbbac
75
76 /^(b+|a){1,2}c/
77     bc
78     bbc
79     bbbc
80     bac
81     bbac
82     aac
83     abbbbbbbbbbbc
84     bbbbbbbbbbbac
85     *** Failers
86     aaac
87     abbbbbbbbbbbac
88
89 /^(b+|a){1,2}?bc/
90     bbc
91
92 /^(b*|ba){1,2}?bc/
93     babc
94     bbabc
95     bababc
96     *** Failers
97     bababbc
98     babababc
99
100 /^(ba|b*){1,2}?bc/
101     babc
102     bbabc
103     bababc
104     *** Failers
105     bababbc
106     babababc
107
108 /^\ca\cA\c[\c{\c:/
109     \x01\x01\e;z
110
111 /^[ab\]cde]/
112     athing
113     bthing
114     ]thing
115     cthing
116     dthing
117     ething
118     *** Failers
119     fthing
120     [thing
121     \\thing
122
123 /^[]cde]/
124     ]thing
125     cthing
126     dthing
127     ething
128     *** Failers
129     athing
130     fthing
131
132 /^[^ab\]cde]/
133     fthing
134     [thing
135     \\thing
136     *** Failers
137     athing
138     bthing
139     ]thing
140     cthing
141     dthing
142     ething
143
144 /^[^]cde]/
145     athing
146     fthing
147     *** Failers
148     ]thing
149     cthing
150     dthing
151     ething
152
153 /^\\81/
154     \81
155
156 /^ÿ/
157     ÿ
158
159 /^[0-9]+$/
160     0
161     1
162     2
163     3
164     4
165     5
166     6
167     7
168     8
169     9
170     10
171     100
172     *** Failers
173     abc
174
175 /^.*nter/
176     enter
177     inter
178     uponter
179
180 /^xxx[0-9]+$/
181     xxx0
182     xxx1234
183     *** Failers
184     xxx
185
186 /^.+[0-9][0-9][0-9]$/
187     x123
188     xx123
189     123456
190     *** Failers
191     123
192     x1234
193
194 /^.+?[0-9][0-9][0-9]$/
195     x123
196     xx123
197     123456
198     *** Failers
199     123
200     x1234
201
202 /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
203     abc!pqr=apquxz.ixr.zzz.ac.uk
204     *** Failers
205     !pqr=apquxz.ixr.zzz.ac.uk
206     abc!=apquxz.ixr.zzz.ac.uk
207     abc!pqr=apquxz:ixr.zzz.ac.uk
208     abc!pqr=apquxz.ixr.zzz.ac.ukk
209
210 /:/
211     Well, we need a colon: somewhere
212     *** Fail if we don't
213
214 /([\da-f:]+)$/i
215     0abc
216     abc
217     fed
218     E
219     ::
220     5f03:12C0::932e
221     fed def
222     Any old stuff
223     *** Failers
224     0zzz
225     gzzz
226     fed\x20
227     Any old rubbish
228
229 /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
230     .1.2.3
231     A.12.123.0
232     *** Failers
233     .1.2.3333
234     1.2.3
235     1234.2.3
236
237 /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
238     1 IN SOA non-sp1 non-sp2(
239     1    IN    SOA    non-sp1    non-sp2   (
240     *** Failers
241     1IN SOA non-sp1 non-sp2(
242
243 /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
244     a.
245     Z.
246     2.
247     ab-c.pq-r.
248     sxk.zzz.ac.uk.
249     x-.y-.
250     *** Failers
251     -abc.peq.
252
253 /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
254     *.a
255     *.b0-a
256     *.c3-b.c
257     *.c-a.b-c
258     *** Failers
259     *.0
260     *.a-
261     *.a-b.c-
262     *.c-a.0-c
263
264 /^(?=ab(de))(abd)(e)/
265     abde
266
267 /^(?!(ab)de|x)(abd)(f)/
268     abdf
269
270 /^(?=(ab(cd)))(ab)/
271     abcd
272
273 /^[\da-f](\.[\da-f])*$/i
274     a.b.c.d
275     A.B.C.D
276     a.b.c.1.2.3.C
277
278 /^\".*\"\s*(;.*)?$/
279     \"1234\"
280     \"abcd\" ;
281     \"\" ; rhubarb
282     *** Failers
283     \"1234\" : things
284
285 /^$/
286     \
287     *** Failers
288
289 /   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
290     ab c
291     *** Failers
292     abc
293     ab cde
294
295 /(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
296     ab c
297     *** Failers
298     abc
299     ab cde
300
301 /^   a\ b[c ]d       $/x
302     a bcd
303     a b d
304     *** Failers
305     abcd
306     ab d
307
308 /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
309     abcdefhijklm
310
311 /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
312     abcdefhijklm
313
314 /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
315     a+ Z0+\x08\n\x1d\x12
316
317 /^[.^$|()*+?{,}]+/
318     .^\$(*+)|{?,?}
319
320 /^a*\w/
321     z
322     az
323     aaaz
324     a
325     aa
326     aaaa
327     a+
328     aa+
329
330 /^a*?\w/
331     z
332     az
333     aaaz
334     a
335     aa
336     aaaa
337     a+
338     aa+
339
340 /^a+\w/
341     az
342     aaaz
343     aa
344     aaaa
345     aa+
346
347 /^a+?\w/
348     az
349     aaaz
350     aa
351     aaaa
352     aa+
353
354 /^\d{8}\w{2,}/
355     1234567890
356     12345678ab
357     12345678__
358     *** Failers
359     1234567
360
361 /^[aeiou\d]{4,5}$/
362     uoie
363     1234
364     12345
365     aaaaa
366     *** Failers
367     123456
368
369 /^[aeiou\d]{4,5}?/
370     uoie
371     1234
372     12345
373     aaaaa
374     123456
375
376 /\A(abc|def)=(\1){2,3}\Z/
377     abc=abcabc
378     def=defdefdef
379     *** Failers
380     abc=defdef
381
382 /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
383     abcdefghijkcda2
384     abcdefghijkkkkcda2
385
386 /(cat(a(ract|tonic)|erpillar)) \1()2(3)/
387     cataract cataract23
388     catatonic catatonic23
389     caterpillar caterpillar23
390
391
392 /^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
393     From abcd  Mon Sep 01 12:33:02 1997
394
395 /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
396     From abcd  Mon Sep 01 12:33:02 1997
397     From abcd  Mon Sep  1 12:33:02 1997
398     *** Failers
399     From abcd  Sep 01 12:33:02 1997
400
401 /^12.34/s
402     12\n34
403     12\r34
404
405 /\w+(?=\t)/
406     the quick brown\t fox
407
408 /foo(?!bar)(.*)/
409     foobar is foolish see?
410
411 /(?:(?!foo)...|^.{0,2})bar(.*)/
412     foobar crowbar etc
413     barrel
414     2barrel
415     A barrel
416
417 /^(\D*)(?=\d)(?!123)/
418     abc456
419     *** Failers
420     abc123
421
422 /^1234(?# test newlines
423   inside)/
424     1234
425
426 /^1234 #comment in extended re
427   /x
428     1234
429
430 /#rhubarb
431   abcd/x
432     abcd
433
434 /^abcd#rhubarb/x
435     abcd
436
437 /^(a)\1{2,3}(.)/
438     aaab
439     aaaab
440     aaaaab
441     aaaaaab
442
443 /(?!^)abc/
444     the abc
445     *** Failers
446     abc
447
448 /(?=^)abc/
449     abc
450     *** Failers
451     the abc
452
453 /^[ab]{1,3}(ab*|b)/
454     aabbbbb
455
456 /^[ab]{1,3}?(ab*|b)/
457     aabbbbb
458
459 /^[ab]{1,3}?(ab*?|b)/
460     aabbbbb
461
462 /^[ab]{1,3}(ab*?|b)/
463     aabbbbb
464
465 /  (?: [\040\t] |  \(
466 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
467 \)  )*                          # optional leading comment
468 (?:    (?:
469 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
470 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
471 |
472 " (?:                      # opening quote...
473 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
474 |                     #    or
475 \\ [^\x80-\xff]           #   Escaped something (something != CR)
476 )* "  # closing quote
477 )                    # initial word
478 (?:  (?: [\040\t] |  \(
479 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
480 \)  )*  \.  (?: [\040\t] |  \(
481 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
482 \)  )*   (?:
483 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
484 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
485 |
486 " (?:                      # opening quote...
487 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
488 |                     #    or
489 \\ [^\x80-\xff]           #   Escaped something (something != CR)
490 )* "  # closing quote
491 )  )* # further okay, if led by a period
492 (?: [\040\t] |  \(
493 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
494 \)  )*  @  (?: [\040\t] |  \(
495 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
496 \)  )*    (?:
497 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
498 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
499 |   \[                         # [
500 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
501 \]                        #           ]
502 )                           # initial subdomain
503 (?:                                  #
504 (?: [\040\t] |  \(
505 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
506 \)  )*  \.                        # if led by a period...
507 (?: [\040\t] |  \(
508 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
509 \)  )*   (?:
510 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
511 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
512 |   \[                         # [
513 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
514 \]                        #           ]
515 )                     #   ...further okay
516 )*
517 # address
518 |                     #  or
519 (?:
520 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
521 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
522 |
523 " (?:                      # opening quote...
524 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
525 |                     #    or
526 \\ [^\x80-\xff]           #   Escaped something (something != CR)
527 )* "  # closing quote
528 )             # one word, optionally followed by....
529 (?:
530 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
531 \(
532 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
533 \)       |  # comments, or...
534
535 " (?:                      # opening quote...
536 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
537 |                     #    or
538 \\ [^\x80-\xff]           #   Escaped something (something != CR)
539 )* "  # closing quote
540 # quoted strings
541 )*
542 <  (?: [\040\t] |  \(
543 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
544 \)  )*                     # leading <
545 (?:  @  (?: [\040\t] |  \(
546 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
547 \)  )*    (?:
548 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
549 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
550 |   \[                         # [
551 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
552 \]                        #           ]
553 )                           # initial subdomain
554 (?:                                  #
555 (?: [\040\t] |  \(
556 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
557 \)  )*  \.                        # if led by a period...
558 (?: [\040\t] |  \(
559 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
560 \)  )*   (?:
561 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
562 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
563 |   \[                         # [
564 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
565 \]                        #           ]
566 )                     #   ...further okay
567 )*
568
569 (?:  (?: [\040\t] |  \(
570 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
571 \)  )*  ,  (?: [\040\t] |  \(
572 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
573 \)  )*  @  (?: [\040\t] |  \(
574 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
575 \)  )*    (?:
576 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
577 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
578 |   \[                         # [
579 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
580 \]                        #           ]
581 )                           # initial subdomain
582 (?:                                  #
583 (?: [\040\t] |  \(
584 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
585 \)  )*  \.                        # if led by a period...
586 (?: [\040\t] |  \(
587 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
588 \)  )*   (?:
589 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
590 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
591 |   \[                         # [
592 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
593 \]                        #           ]
594 )                     #   ...further okay
595 )*
596 )* # further okay, if led by comma
597 :                                # closing colon
598 (?: [\040\t] |  \(
599 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
600 \)  )*  )? #       optional route
601 (?:
602 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
603 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
604 |
605 " (?:                      # opening quote...
606 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
607 |                     #    or
608 \\ [^\x80-\xff]           #   Escaped something (something != CR)
609 )* "  # closing quote
610 )                    # initial word
611 (?:  (?: [\040\t] |  \(
612 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
613 \)  )*  \.  (?: [\040\t] |  \(
614 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
615 \)  )*   (?:
616 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
617 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
618 |
619 " (?:                      # opening quote...
620 [^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
621 |                     #    or
622 \\ [^\x80-\xff]           #   Escaped something (something != CR)
623 )* "  # closing quote
624 )  )* # further okay, if led by a period
625 (?: [\040\t] |  \(
626 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
627 \)  )*  @  (?: [\040\t] |  \(
628 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
629 \)  )*    (?:
630 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
631 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
632 |   \[                         # [
633 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
634 \]                        #           ]
635 )                           # initial subdomain
636 (?:                                  #
637 (?: [\040\t] |  \(
638 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
639 \)  )*  \.                        # if led by a period...
640 (?: [\040\t] |  \(
641 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
642 \)  )*   (?:
643 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
644 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
645 |   \[                         # [
646 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
647 \]                        #           ]
648 )                     #   ...further okay
649 )*
650 #       address spec
651 (?: [\040\t] |  \(
652 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
653 \)  )*  > #                  trailing >
654 # name and address
655 )  (?: [\040\t] |  \(
656 (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
657 \)  )*                       # optional trailing comment
658 /x
659     Alan Other <user\@dom.ain>
660     <user\@dom.ain>
661     user\@dom.ain
662     \"A. Other\" <user.1234\@dom.ain> (a comment)
663     A. Other <user.1234\@dom.ain> (a comment)
664     \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
665     A missing angle <user\@some.where
666     *** Failers
667     The quick brown fox
668
669 /[\040\t]*                    # Nab whitespace.
670 (?:
671 \(                              #  (
672 [^\\\x80-\xff\n\015()] *                             #     normal*
673 (?:                                 #       (
674 (?:  \\ [^\x80-\xff]  |
675 \(                            #  (
676 [^\\\x80-\xff\n\015()] *                            #     normal*
677 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
678 \)                           #                       )
679 )    #         special
680 [^\\\x80-\xff\n\015()] *                         #         normal*
681 )*                                  #            )*
682 \)                             #                )
683 [\040\t]* )*    # If comment found, allow more spaces.
684 # optional leading comment
685 (?:
686 (?:
687 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
688 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
689 # Atom
690 |                       #  or
691 "                                     # "
692 [^\\\x80-\xff\n\015"] *                            #   normal
693 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
694 "                                     #        "
695 # Quoted string
696 )
697 [\040\t]*                    # Nab whitespace.
698 (?:
699 \(                              #  (
700 [^\\\x80-\xff\n\015()] *                             #     normal*
701 (?:                                 #       (
702 (?:  \\ [^\x80-\xff]  |
703 \(                            #  (
704 [^\\\x80-\xff\n\015()] *                            #     normal*
705 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
706 \)                           #                       )
707 )    #         special
708 [^\\\x80-\xff\n\015()] *                         #         normal*
709 )*                                  #            )*
710 \)                             #                )
711 [\040\t]* )*    # If comment found, allow more spaces.
712 (?:
713 \.
714 [\040\t]*                    # Nab whitespace.
715 (?:
716 \(                              #  (
717 [^\\\x80-\xff\n\015()] *                             #     normal*
718 (?:                                 #       (
719 (?:  \\ [^\x80-\xff]  |
720 \(                            #  (
721 [^\\\x80-\xff\n\015()] *                            #     normal*
722 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
723 \)                           #                       )
724 )    #         special
725 [^\\\x80-\xff\n\015()] *                         #         normal*
726 )*                                  #            )*
727 \)                             #                )
728 [\040\t]* )*    # If comment found, allow more spaces.
729 (?:
730 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
731 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
732 # Atom
733 |                       #  or
734 "                                     # "
735 [^\\\x80-\xff\n\015"] *                            #   normal
736 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
737 "                                     #        "
738 # Quoted string
739 )
740 [\040\t]*                    # Nab whitespace.
741 (?:
742 \(                              #  (
743 [^\\\x80-\xff\n\015()] *                             #     normal*
744 (?:                                 #       (
745 (?:  \\ [^\x80-\xff]  |
746 \(                            #  (
747 [^\\\x80-\xff\n\015()] *                            #     normal*
748 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
749 \)                           #                       )
750 )    #         special
751 [^\\\x80-\xff\n\015()] *                         #         normal*
752 )*                                  #            )*
753 \)                             #                )
754 [\040\t]* )*    # If comment found, allow more spaces.
755 # additional words
756 )*
757 @
758 [\040\t]*                    # Nab whitespace.
759 (?:
760 \(                              #  (
761 [^\\\x80-\xff\n\015()] *                             #     normal*
762 (?:                                 #       (
763 (?:  \\ [^\x80-\xff]  |
764 \(                            #  (
765 [^\\\x80-\xff\n\015()] *                            #     normal*
766 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
767 \)                           #                       )
768 )    #         special
769 [^\\\x80-\xff\n\015()] *                         #         normal*
770 )*                                  #            )*
771 \)                             #                )
772 [\040\t]* )*    # If comment found, allow more spaces.
773 (?:
774 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
775 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
776 |
777 \[                            # [
778 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
779 \]                           #           ]
780 )
781 [\040\t]*                    # Nab whitespace.
782 (?:
783 \(                              #  (
784 [^\\\x80-\xff\n\015()] *                             #     normal*
785 (?:                                 #       (
786 (?:  \\ [^\x80-\xff]  |
787 \(                            #  (
788 [^\\\x80-\xff\n\015()] *                            #     normal*
789 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
790 \)                           #                       )
791 )    #         special
792 [^\\\x80-\xff\n\015()] *                         #         normal*
793 )*                                  #            )*
794 \)                             #                )
795 [\040\t]* )*    # If comment found, allow more spaces.
796 # optional trailing comments
797 (?:
798 \.
799 [\040\t]*                    # Nab whitespace.
800 (?:
801 \(                              #  (
802 [^\\\x80-\xff\n\015()] *                             #     normal*
803 (?:                                 #       (
804 (?:  \\ [^\x80-\xff]  |
805 \(                            #  (
806 [^\\\x80-\xff\n\015()] *                            #     normal*
807 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
808 \)                           #                       )
809 )    #         special
810 [^\\\x80-\xff\n\015()] *                         #         normal*
811 )*                                  #            )*
812 \)                             #                )
813 [\040\t]* )*    # If comment found, allow more spaces.
814 (?:
815 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
816 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
817 |
818 \[                            # [
819 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
820 \]                           #           ]
821 )
822 [\040\t]*                    # Nab whitespace.
823 (?:
824 \(                              #  (
825 [^\\\x80-\xff\n\015()] *                             #     normal*
826 (?:                                 #       (
827 (?:  \\ [^\x80-\xff]  |
828 \(                            #  (
829 [^\\\x80-\xff\n\015()] *                            #     normal*
830 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
831 \)                           #                       )
832 )    #         special
833 [^\\\x80-\xff\n\015()] *                         #         normal*
834 )*                                  #            )*
835 \)                             #                )
836 [\040\t]* )*    # If comment found, allow more spaces.
837 # optional trailing comments
838 )*
839 # address
840 |                             #  or
841 (?:
842 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
843 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
844 # Atom
845 |                       #  or
846 "                                     # "
847 [^\\\x80-\xff\n\015"] *                            #   normal
848 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
849 "                                     #        "
850 # Quoted string
851 )
852 # leading word
853 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
854 (?:
855 (?:
856 \(                              #  (
857 [^\\\x80-\xff\n\015()] *                             #     normal*
858 (?:                                 #       (
859 (?:  \\ [^\x80-\xff]  |
860 \(                            #  (
861 [^\\\x80-\xff\n\015()] *                            #     normal*
862 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
863 \)                           #                       )
864 )    #         special
865 [^\\\x80-\xff\n\015()] *                         #         normal*
866 )*                                  #            )*
867 \)                             #                )
868 |
869 "                                     # "
870 [^\\\x80-\xff\n\015"] *                            #   normal
871 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
872 "                                     #        "
873 ) # "special" comment or quoted string
874 [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
875 )*
876 <
877 [\040\t]*                    # Nab whitespace.
878 (?:
879 \(                              #  (
880 [^\\\x80-\xff\n\015()] *                             #     normal*
881 (?:                                 #       (
882 (?:  \\ [^\x80-\xff]  |
883 \(                            #  (
884 [^\\\x80-\xff\n\015()] *                            #     normal*
885 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
886 \)                           #                       )
887 )    #         special
888 [^\\\x80-\xff\n\015()] *                         #         normal*
889 )*                                  #            )*
890 \)                             #                )
891 [\040\t]* )*    # If comment found, allow more spaces.
892 # <
893 (?:
894 @
895 [\040\t]*                    # Nab whitespace.
896 (?:
897 \(                              #  (
898 [^\\\x80-\xff\n\015()] *                             #     normal*
899 (?:                                 #       (
900 (?:  \\ [^\x80-\xff]  |
901 \(                            #  (
902 [^\\\x80-\xff\n\015()] *                            #     normal*
903 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
904 \)                           #                       )
905 )    #         special
906 [^\\\x80-\xff\n\015()] *                         #         normal*
907 )*                                  #            )*
908 \)                             #                )
909 [\040\t]* )*    # If comment found, allow more spaces.
910 (?:
911 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
912 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
913 |
914 \[                            # [
915 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
916 \]                           #           ]
917 )
918 [\040\t]*                    # Nab whitespace.
919 (?:
920 \(                              #  (
921 [^\\\x80-\xff\n\015()] *                             #     normal*
922 (?:                                 #       (
923 (?:  \\ [^\x80-\xff]  |
924 \(                            #  (
925 [^\\\x80-\xff\n\015()] *                            #     normal*
926 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
927 \)                           #                       )
928 )    #         special
929 [^\\\x80-\xff\n\015()] *                         #         normal*
930 )*                                  #            )*
931 \)                             #                )
932 [\040\t]* )*    # If comment found, allow more spaces.
933 # optional trailing comments
934 (?:
935 \.
936 [\040\t]*                    # Nab whitespace.
937 (?:
938 \(                              #  (
939 [^\\\x80-\xff\n\015()] *                             #     normal*
940 (?:                                 #       (
941 (?:  \\ [^\x80-\xff]  |
942 \(                            #  (
943 [^\\\x80-\xff\n\015()] *                            #     normal*
944 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
945 \)                           #                       )
946 )    #         special
947 [^\\\x80-\xff\n\015()] *                         #         normal*
948 )*                                  #            )*
949 \)                             #                )
950 [\040\t]* )*    # If comment found, allow more spaces.
951 (?:
952 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
953 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
954 |
955 \[                            # [
956 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
957 \]                           #           ]
958 )
959 [\040\t]*                    # Nab whitespace.
960 (?:
961 \(                              #  (
962 [^\\\x80-\xff\n\015()] *                             #     normal*
963 (?:                                 #       (
964 (?:  \\ [^\x80-\xff]  |
965 \(                            #  (
966 [^\\\x80-\xff\n\015()] *                            #     normal*
967 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
968 \)                           #                       )
969 )    #         special
970 [^\\\x80-\xff\n\015()] *                         #         normal*
971 )*                                  #            )*
972 \)                             #                )
973 [\040\t]* )*    # If comment found, allow more spaces.
974 # optional trailing comments
975 )*
976 (?: ,
977 [\040\t]*                    # Nab whitespace.
978 (?:
979 \(                              #  (
980 [^\\\x80-\xff\n\015()] *                             #     normal*
981 (?:                                 #       (
982 (?:  \\ [^\x80-\xff]  |
983 \(                            #  (
984 [^\\\x80-\xff\n\015()] *                            #     normal*
985 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
986 \)                           #                       )
987 )    #         special
988 [^\\\x80-\xff\n\015()] *                         #         normal*
989 )*                                  #            )*
990 \)                             #                )
991 [\040\t]* )*    # If comment found, allow more spaces.
992 @
993 [\040\t]*                    # Nab whitespace.
994 (?:
995 \(                              #  (
996 [^\\\x80-\xff\n\015()] *                             #     normal*
997 (?:                                 #       (
998 (?:  \\ [^\x80-\xff]  |
999 \(                            #  (
1000 [^\\\x80-\xff\n\015()] *                            #     normal*
1001 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1002 \)                           #                       )
1003 )    #         special
1004 [^\\\x80-\xff\n\015()] *                         #         normal*
1005 )*                                  #            )*
1006 \)                             #                )
1007 [\040\t]* )*    # If comment found, allow more spaces.
1008 (?:
1009 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1010 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1011 |
1012 \[                            # [
1013 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1014 \]                           #           ]
1015 )
1016 [\040\t]*                    # Nab whitespace.
1017 (?:
1018 \(                              #  (
1019 [^\\\x80-\xff\n\015()] *                             #     normal*
1020 (?:                                 #       (
1021 (?:  \\ [^\x80-\xff]  |
1022 \(                            #  (
1023 [^\\\x80-\xff\n\015()] *                            #     normal*
1024 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1025 \)                           #                       )
1026 )    #         special
1027 [^\\\x80-\xff\n\015()] *                         #         normal*
1028 )*                                  #            )*
1029 \)                             #                )
1030 [\040\t]* )*    # If comment found, allow more spaces.
1031 # optional trailing comments
1032 (?:
1033 \.
1034 [\040\t]*                    # Nab whitespace.
1035 (?:
1036 \(                              #  (
1037 [^\\\x80-\xff\n\015()] *                             #     normal*
1038 (?:                                 #       (
1039 (?:  \\ [^\x80-\xff]  |
1040 \(                            #  (
1041 [^\\\x80-\xff\n\015()] *                            #     normal*
1042 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1043 \)                           #                       )
1044 )    #         special
1045 [^\\\x80-\xff\n\015()] *                         #         normal*
1046 )*                                  #            )*
1047 \)                             #                )
1048 [\040\t]* )*    # If comment found, allow more spaces.
1049 (?:
1050 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1051 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1052 |
1053 \[                            # [
1054 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1055 \]                           #           ]
1056 )
1057 [\040\t]*                    # Nab whitespace.
1058 (?:
1059 \(                              #  (
1060 [^\\\x80-\xff\n\015()] *                             #     normal*
1061 (?:                                 #       (
1062 (?:  \\ [^\x80-\xff]  |
1063 \(                            #  (
1064 [^\\\x80-\xff\n\015()] *                            #     normal*
1065 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1066 \)                           #                       )
1067 )    #         special
1068 [^\\\x80-\xff\n\015()] *                         #         normal*
1069 )*                                  #            )*
1070 \)                             #                )
1071 [\040\t]* )*    # If comment found, allow more spaces.
1072 # optional trailing comments
1073 )*
1074 )*  # additional domains
1075 :
1076 [\040\t]*                    # Nab whitespace.
1077 (?:
1078 \(                              #  (
1079 [^\\\x80-\xff\n\015()] *                             #     normal*
1080 (?:                                 #       (
1081 (?:  \\ [^\x80-\xff]  |
1082 \(                            #  (
1083 [^\\\x80-\xff\n\015()] *                            #     normal*
1084 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1085 \)                           #                       )
1086 )    #         special
1087 [^\\\x80-\xff\n\015()] *                         #         normal*
1088 )*                                  #            )*
1089 \)                             #                )
1090 [\040\t]* )*    # If comment found, allow more spaces.
1091 # optional trailing comments
1092 )?     #       optional route
1093 (?:
1094 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1095 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1096 # Atom
1097 |                       #  or
1098 "                                     # "
1099 [^\\\x80-\xff\n\015"] *                            #   normal
1100 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1101 "                                     #        "
1102 # Quoted string
1103 )
1104 [\040\t]*                    # Nab whitespace.
1105 (?:
1106 \(                              #  (
1107 [^\\\x80-\xff\n\015()] *                             #     normal*
1108 (?:                                 #       (
1109 (?:  \\ [^\x80-\xff]  |
1110 \(                            #  (
1111 [^\\\x80-\xff\n\015()] *                            #     normal*
1112 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1113 \)                           #                       )
1114 )    #         special
1115 [^\\\x80-\xff\n\015()] *                         #         normal*
1116 )*                                  #            )*
1117 \)                             #                )
1118 [\040\t]* )*    # If comment found, allow more spaces.
1119 (?:
1120 \.
1121 [\040\t]*                    # Nab whitespace.
1122 (?:
1123 \(                              #  (
1124 [^\\\x80-\xff\n\015()] *                             #     normal*
1125 (?:                                 #       (
1126 (?:  \\ [^\x80-\xff]  |
1127 \(                            #  (
1128 [^\\\x80-\xff\n\015()] *                            #     normal*
1129 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1130 \)                           #                       )
1131 )    #         special
1132 [^\\\x80-\xff\n\015()] *                         #         normal*
1133 )*                                  #            )*
1134 \)                             #                )
1135 [\040\t]* )*    # If comment found, allow more spaces.
1136 (?:
1137 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1138 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1139 # Atom
1140 |                       #  or
1141 "                                     # "
1142 [^\\\x80-\xff\n\015"] *                            #   normal
1143 (?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
1144 "                                     #        "
1145 # Quoted string
1146 )
1147 [\040\t]*                    # Nab whitespace.
1148 (?:
1149 \(                              #  (
1150 [^\\\x80-\xff\n\015()] *                             #     normal*
1151 (?:                                 #       (
1152 (?:  \\ [^\x80-\xff]  |
1153 \(                            #  (
1154 [^\\\x80-\xff\n\015()] *                            #     normal*
1155 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1156 \)                           #                       )
1157 )    #         special
1158 [^\\\x80-\xff\n\015()] *                         #         normal*
1159 )*                                  #            )*
1160 \)                             #                )
1161 [\040\t]* )*    # If comment found, allow more spaces.
1162 # additional words
1163 )*
1164 @
1165 [\040\t]*                    # Nab whitespace.
1166 (?:
1167 \(                              #  (
1168 [^\\\x80-\xff\n\015()] *                             #     normal*
1169 (?:                                 #       (
1170 (?:  \\ [^\x80-\xff]  |
1171 \(                            #  (
1172 [^\\\x80-\xff\n\015()] *                            #     normal*
1173 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1174 \)                           #                       )
1175 )    #         special
1176 [^\\\x80-\xff\n\015()] *                         #         normal*
1177 )*                                  #            )*
1178 \)                             #                )
1179 [\040\t]* )*    # If comment found, allow more spaces.
1180 (?:
1181 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1182 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1183 |
1184 \[                            # [
1185 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1186 \]                           #           ]
1187 )
1188 [\040\t]*                    # Nab whitespace.
1189 (?:
1190 \(                              #  (
1191 [^\\\x80-\xff\n\015()] *                             #     normal*
1192 (?:                                 #       (
1193 (?:  \\ [^\x80-\xff]  |
1194 \(                            #  (
1195 [^\\\x80-\xff\n\015()] *                            #     normal*
1196 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1197 \)                           #                       )
1198 )    #         special
1199 [^\\\x80-\xff\n\015()] *                         #         normal*
1200 )*                                  #            )*
1201 \)                             #                )
1202 [\040\t]* )*    # If comment found, allow more spaces.
1203 # optional trailing comments
1204 (?:
1205 \.
1206 [\040\t]*                    # Nab whitespace.
1207 (?:
1208 \(                              #  (
1209 [^\\\x80-\xff\n\015()] *                             #     normal*
1210 (?:                                 #       (
1211 (?:  \\ [^\x80-\xff]  |
1212 \(                            #  (
1213 [^\\\x80-\xff\n\015()] *                            #     normal*
1214 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1215 \)                           #                       )
1216 )    #         special
1217 [^\\\x80-\xff\n\015()] *                         #         normal*
1218 )*                                  #            )*
1219 \)                             #                )
1220 [\040\t]* )*    # If comment found, allow more spaces.
1221 (?:
1222 [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
1223 (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1224 |
1225 \[                            # [
1226 (?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
1227 \]                           #           ]
1228 )
1229 [\040\t]*                    # Nab whitespace.
1230 (?:
1231 \(                              #  (
1232 [^\\\x80-\xff\n\015()] *                             #     normal*
1233 (?:                                 #       (
1234 (?:  \\ [^\x80-\xff]  |
1235 \(                            #  (
1236 [^\\\x80-\xff\n\015()] *                            #     normal*
1237 (?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
1238 \)                           #                       )
1239 )    #         special
1240 [^\\\x80-\xff\n\015()] *                         #         normal*
1241 )*                                  #            )*
1242 \)                             #                )
1243 [\040\t]* )*    # If comment found, allow more spaces.
1244 # optional trailing comments
1245 )*
1246 #       address spec
1247 >                    #                 >
1248 # name and address
1249 )
1250 /x
1251     Alan Other <user\@dom.ain>
1252     <user\@dom.ain>
1253     user\@dom.ain
1254     \"A. Other\" <user.1234\@dom.ain> (a comment)
1255     A. Other <user.1234\@dom.ain> (a comment)
1256     \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1257     A missing angle <user\@some.where
1258     *** Failers
1259     The quick brown fox
1260
1261 /abc\0def\00pqr\000xyz\0000AB/
1262     abc\0def\00pqr\000xyz\0000AB
1263     abc456 abc\0def\00pqr\000xyz\0000ABCDE
1264
1265 /abc\x0def\x00pqr\x000xyz\x0000AB/
1266     abc\x0def\x00pqr\x000xyz\x0000AB
1267     abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
1268
1269 /^[\000-\037]/
1270     \0A
1271     \01B
1272     \037C
1273
1274 /\0*/
1275     \0\0\0\0
1276
1277 /A\x0{2,3}Z/
1278     The A\x0\x0Z
1279     An A\0\x0\0Z
1280     *** Failers
1281     A\0Z
1282     A\0\x0\0\x0Z
1283
1284 /^(cow|)\1(bell)/
1285     cowcowbell
1286     bell
1287     *** Failers
1288     cowbell
1289
1290 /^\s/
1291     \040abc
1292     \x0cabc
1293     \nabc
1294     \rabc
1295     \tabc
1296     *** Failers
1297     abc
1298
1299 /^a     b
1300   \r  \f  c/x
1301     abc
1302
1303 /^(a|)\1*b/
1304     ab
1305     aaaab
1306     b
1307     *** Failers
1308     acb
1309
1310 /^(a|)\1+b/
1311     aab
1312     aaaab
1313     b
1314     *** Failers
1315     ab
1316
1317 /^(a|)\1?b/
1318     ab
1319     aab
1320     b
1321     *** Failers
1322     acb
1323
1324 /^(a|)\1{2}b/
1325     aaab
1326     b
1327     *** Failers
1328     ab
1329     aab
1330     aaaab
1331
1332 /^(a|)\1{2,3}b/
1333     aaab
1334     aaaab
1335     b
1336     *** Failers
1337     ab
1338     aab
1339     aaaaab
1340
1341 /ab{1,3}bc/
1342     abbbbc
1343     abbbc
1344     abbc
1345     *** Failers
1346     abc
1347     abbbbbc
1348
1349 /([^.]*)\.([^:]*):[T ]+(.*)/
1350     track1.title:TBlah blah blah
1351
1352 /([^.]*)\.([^:]*):[T ]+(.*)/i
1353     track1.title:TBlah blah blah
1354
1355 /([^.]*)\.([^:]*):[t ]+(.*)/i
1356     track1.title:TBlah blah blah
1357
1358 /^[W-c]+$/
1359     WXY_^abc
1360     *** Failers
1361     wxy
1362
1363 /^[W-c]+$/i
1364     WXY_^abc
1365     wxy_^ABC
1366
1367 /^[\x3f-\x5F]+$/i
1368     WXY_^abc
1369     wxy_^ABC
1370
1371 /^abc$/m
1372     abc
1373     qqq\nabc
1374     abc\nzzz
1375     qqq\nabc\nzzz
1376
1377 /^abc$/
1378     abc
1379     *** Failers
1380     qqq\nabc
1381     abc\nzzz
1382     qqq\nabc\nzzz
1383
1384 /\Aabc\Z/m
1385     abc
1386     abc\n 
1387     *** Failers
1388     qqq\nabc
1389     abc\nzzz
1390     qqq\nabc\nzzz
1391     
1392 /\A(.)*\Z/s
1393     abc\ndef
1394
1395 /\A(.)*\Z/m
1396     *** Failers
1397     abc\ndef
1398
1399 /(?:b)|(?::+)/
1400     b::c
1401     c::b
1402
1403 /[-az]+/
1404     az-
1405     *** Failers
1406     b
1407
1408 /[az-]+/
1409     za-
1410     *** Failers
1411     b
1412
1413 /[a\-z]+/
1414     a-z
1415     *** Failers
1416     b
1417
1418 /[a-z]+/
1419     abcdxyz
1420
1421 /[\d-]+/
1422     12-34
1423     *** Failers
1424     aaa
1425
1426 /[\d-z]+/
1427     12-34z
1428     *** Failers
1429     aaa
1430
1431 /\x5c/
1432     \\
1433
1434 /\x20Z/
1435     the Zoo
1436     *** Failers
1437     Zulu
1438
1439 /(abc)\1/i
1440     abcabc
1441     ABCabc
1442     abcABC
1443
1444 /ab{3cd/
1445     ab{3cd
1446
1447 /ab{3,cd/
1448     ab{3,cd
1449
1450 /ab{3,4a}cd/
1451     ab{3,4a}cd
1452
1453 /{4,5a}bc/
1454     {4,5a}bc
1455
1456 /^a.b/
1457     a\rb
1458     *** Failers
1459     a\nb
1460
1461 /abc$/
1462     abc
1463     abc\n
1464     *** Failers
1465     abc\ndef
1466
1467 /(abc)\123/
1468     abc\x53
1469
1470 /(abc)\223/
1471     abc\x93
1472
1473 /(abc)\323/
1474     abc\xd3
1475
1476 /(abc)\500/
1477     abc\x40
1478     abc\100
1479
1480 /(abc)\5000/
1481     abc\x400
1482     abc\x40\x30
1483     abc\1000
1484     abc\100\x30
1485     abc\100\060
1486     abc\100\60
1487
1488 /abc\81/
1489     abc\081
1490     abc\0\x38\x31
1491
1492 /abc\91/
1493     abc\091
1494     abc\0\x39\x31
1495
1496 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
1497     abcdefghijkllS
1498
1499 /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
1500     abcdefghijk\12S
1501
1502 /ab\gdef/
1503     abgdef
1504
1505 /a{0}bc/
1506     bc
1507
1508 /(a|(bc)){0,0}?xyz/
1509     xyz
1510
1511 /abc[\10]de/
1512     abc\010de
1513
1514 /abc[\1]de/
1515     abc\1de
1516
1517 /(abc)[\1]de/
1518     abc\1de
1519
1520 /(?s)a.b/
1521     a\nb
1522
1523 /^([^a])([^\b])([^c]*)([^d]{3,4})/
1524     baNOTccccd
1525     baNOTcccd
1526     baNOTccd
1527     bacccd
1528     *** Failers
1529     anything
1530     b\bc   
1531     baccd
1532
1533 /[^a]/
1534     Abc
1535   
1536 /[^a]/i
1537     Abc 
1538
1539 /[^a]+/
1540     AAAaAbc
1541   
1542 /[^a]+/i
1543     AAAaAbc 
1544
1545 /[^a]+/
1546     bbb\nccc
1547    
1548 /[^k]$/
1549     abc
1550     *** Failers
1551     abk   
1552    
1553 /[^k]{2,3}$/
1554     abc
1555     kbc
1556     kabc 
1557     *** Failers
1558     abk
1559     akb
1560     akk 
1561
1562 /^\d{8,}\@.+[^k]$/
1563     12345678\@a.b.c.d
1564     123456789\@x.y.z
1565     *** Failers
1566     12345678\@x.y.uk
1567     1234567\@a.b.c.d       
1568
1569 /(a)\1{8,}/
1570     aaaaaaaaa
1571     aaaaaaaaaa
1572     *** Failers
1573     aaaaaaa   
1574
1575 /[^a]/
1576     aaaabcd
1577     aaAabcd 
1578
1579 /[^a]/i
1580     aaaabcd
1581     aaAabcd 
1582
1583 /[^az]/
1584     aaaabcd
1585     aaAabcd 
1586
1587 /[^az]/i
1588     aaaabcd
1589     aaAabcd 
1590
1591 /\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/
1592  \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
1593
1594 /P[^*]TAIRE[^*]{1,6}?LL/
1595     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
1596
1597 /P[^*]TAIRE[^*]{1,}?LL/
1598     xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
1599
1600 /(\.\d\d[1-9]?)\d+/
1601     1.230003938
1602     1.875000282   
1603     1.235  
1604                   
1605 /(\.\d\d((?=0)|\d(?=\d)))/
1606     1.230003938      
1607     1.875000282
1608     *** Failers 
1609     1.235 
1610     
1611 /a(?)b/
1612     ab 
1613  
1614 /\b(foo)\s+(\w+)/i
1615     Food is on the foo table
1616     
1617 /foo(.*)bar/
1618     The food is under the bar in the barn.
1619     
1620 /foo(.*?)bar/  
1621     The food is under the bar in the barn.
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 /(.*?)(\d+)/
1633     I have 2 numbers: 53147
1634
1635 /(.*)(\d+)$/
1636     I have 2 numbers: 53147
1637
1638 /(.*?)(\d+)$/
1639     I have 2 numbers: 53147
1640
1641 /(.*)\b(\d+)$/
1642     I have 2 numbers: 53147
1643
1644 /(.*\D)(\d+)$/
1645     I have 2 numbers: 53147
1646
1647 /^\D*(?!123)/
1648     ABC123
1649      
1650 /^(\D*)(?=\d)(?!123)/
1651     ABC445
1652     *** Failers
1653     ABC123
1654     
1655 /^[W-]46]/
1656     W46]789 
1657     -46]789
1658     *** Failers
1659     Wall
1660     Zebra
1661     42
1662     [abcd] 
1663     ]abcd[
1664        
1665 /^[W-\]46]/
1666     W46]789 
1667     Wall
1668     Zebra
1669     Xylophone  
1670     42
1671     [abcd] 
1672     ]abcd[
1673     \\backslash 
1674     *** Failers
1675     -46]789
1676     well
1677     
1678 /\d\d\/\d\d\/\d\d\d\d/
1679     01/01/2000
1680
1681 /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
1682   word cat dog elephant mussel cow horse canary baboon snake shark otherword
1683   word cat dog elephant mussel cow horse canary baboon snake shark
1684
1685 /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
1686   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
1687
1688 /^(a){0,0}/
1689     bcd
1690     abc
1691     aab     
1692
1693 /^(a){0,1}/
1694     bcd
1695     abc
1696     aab  
1697
1698 /^(a){0,2}/
1699     bcd
1700     abc
1701     aab  
1702
1703 /^(a){0,3}/
1704     bcd
1705     abc
1706     aab
1707     aaa   
1708
1709 /^(a){0,}/
1710     bcd
1711     abc
1712     aab
1713     aaa
1714     aaaaaaaa    
1715
1716 /^(a){1,1}/
1717     bcd
1718     abc
1719     aab  
1720
1721 /^(a){1,2}/
1722     bcd
1723     abc
1724     aab  
1725
1726 /^(a){1,3}/
1727     bcd
1728     abc
1729     aab
1730     aaa   
1731
1732 /^(a){1,}/
1733     bcd
1734     abc
1735     aab
1736     aaa
1737     aaaaaaaa    
1738
1739 /.*\.gif/
1740     borfle\nbib.gif\nno
1741
1742 /.{0,}\.gif/
1743     borfle\nbib.gif\nno
1744
1745 /.*\.gif/m
1746     borfle\nbib.gif\nno
1747
1748 /.*\.gif/s
1749     borfle\nbib.gif\nno
1750
1751 /.*\.gif/ms
1752     borfle\nbib.gif\nno
1753     
1754 /.*$/
1755     borfle\nbib.gif\nno
1756
1757 /.*$/m
1758     borfle\nbib.gif\nno
1759
1760 /.*$/s
1761     borfle\nbib.gif\nno
1762
1763 /.*$/ms
1764     borfle\nbib.gif\nno
1765     
1766 /.*$/
1767     borfle\nbib.gif\nno\n
1768
1769 /.*$/m
1770     borfle\nbib.gif\nno\n
1771
1772 /.*$/s
1773     borfle\nbib.gif\nno\n
1774
1775 /.*$/ms
1776     borfle\nbib.gif\nno\n
1777     
1778 /(.*X|^B)/
1779     abcde\n1234Xyz
1780     BarFoo 
1781     *** Failers
1782     abcde\nBar  
1783
1784 /(.*X|^B)/m
1785     abcde\n1234Xyz
1786     BarFoo 
1787     abcde\nBar  
1788
1789 /(.*X|^B)/s
1790     abcde\n1234Xyz
1791     BarFoo 
1792     *** Failers
1793     abcde\nBar  
1794
1795 /(.*X|^B)/ms
1796     abcde\n1234Xyz
1797     BarFoo 
1798     abcde\nBar  
1799
1800 /(?s)(.*X|^B)/
1801     abcde\n1234Xyz
1802     BarFoo 
1803     *** Failers 
1804     abcde\nBar  
1805
1806 /(?s:.*X|^B)/
1807     abcde\n1234Xyz
1808     BarFoo 
1809     *** Failers 
1810     abcde\nBar  
1811
1812 /^.*B/
1813     **** Failers
1814     abc\nB
1815      
1816 /(?s)^.*B/
1817     abc\nB
1818
1819 /(?m)^.*B/
1820     abc\nB
1821      
1822 /(?ms)^.*B/
1823     abc\nB
1824
1825 /(?ms)^B/
1826     abc\nB
1827
1828 /(?s)B$/
1829     B\n
1830
1831 /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
1832     123456654321
1833   
1834 /^\d\d\d\d\d\d\d\d\d\d\d\d/
1835     123456654321 
1836
1837 /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
1838     123456654321
1839   
1840 /^[abc]{12}/
1841     abcabcabcabc
1842     
1843 /^[a-c]{12}/
1844     abcabcabcabc
1845     
1846 /^(a|b|c){12}/
1847     abcabcabcabc 
1848
1849 /^[abcdefghijklmnopqrstuvwxy0123456789]/
1850     n
1851     *** Failers 
1852     z 
1853
1854 /abcde{0,0}/
1855     abcd
1856     *** Failers
1857     abce  
1858
1859 /ab[cd]{0,0}e/
1860     abe
1861     *** Failers
1862     abcde 
1863     
1864 /ab(c){0,0}d/
1865     abd
1866     *** Failers
1867     abcd   
1868
1869 /a(b*)/
1870     a
1871     ab
1872     abbbb
1873     *** Failers
1874     bbbbb    
1875     
1876 /ab\d{0}e/
1877     abe
1878     *** Failers
1879     ab1e   
1880     
1881 /"([^\\"]+|\\.)*"/
1882     the \"quick\" brown fox
1883     \"the \\\"quick\\\" brown fox\" 
1884
1885 /.*?/g+
1886     abc
1887   
1888 /\b/g+
1889     abc 
1890
1891 /\b/+g
1892     abc 
1893
1894 //g
1895     abc
1896
1897 /<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
1898   <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>
1899
1900 /a[^a]b/
1901     acb
1902     a\nb
1903     
1904 /a.b/
1905     acb
1906     *** Failers 
1907     a\nb   
1908     
1909 /a[^a]b/s
1910     acb
1911     a\nb  
1912     
1913 /a.b/s
1914     acb
1915     a\nb  
1916
1917 /^(b+?|a){1,2}?c/
1918     bac
1919     bbac
1920     bbbac
1921     bbbbac
1922     bbbbbac 
1923
1924 /^(b+|a){1,2}?c/
1925     bac
1926     bbac
1927     bbbac
1928     bbbbac
1929     bbbbbac 
1930     
1931 /(?!\A)x/m
1932     x\nb\n
1933     a\bx\n  
1934     
1935 /\x0{ab}/
1936     \0{ab} 
1937
1938 /(A|B)*?CD/
1939     CD 
1940     
1941 /(A|B)*CD/
1942     CD 
1943
1944 /(AB)*?\1/
1945     ABABAB
1946
1947 /(AB)*\1/
1948     ABABAB
1949     
1950 /(?<!bar)foo/
1951     foo
1952     catfood
1953     arfootle
1954     rfoosh
1955     *** Failers
1956     barfoo
1957     towbarfoo
1958
1959 /\w{3}(?<!bar)foo/
1960     catfood
1961     *** Failers
1962     foo
1963     barfoo
1964     towbarfoo
1965
1966 /(?<=(foo)a)bar/
1967     fooabar
1968     *** Failers
1969     bar
1970     foobbar
1971       
1972 /\Aabc\z/m
1973     abc
1974     *** Failers
1975     abc\n   
1976     qqq\nabc
1977     abc\nzzz
1978     qqq\nabc\nzzz
1979
1980 "(?>.*/)foo"
1981     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
1982
1983 "(?>.*/)foo"
1984     /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
1985
1986 /(?>(\.\d\d[1-9]?))\d+/
1987     1.230003938
1988     1.875000282
1989     *** Failers 
1990     1.235 
1991
1992 /^((?>\w+)|(?>\s+))*$/
1993     now is the time for all good men to come to the aid of the party
1994     *** Failers
1995     this is not a line with only words and spaces!
1996     
1997 /(\d+)(\w)/
1998     12345a
1999     12345+ 
2000
2001 /((?>\d+))(\w)/
2002     12345a
2003     *** Failers
2004     12345+ 
2005
2006 /(?>a+)b/
2007     aaab
2008
2009 /((?>a+)b)/
2010     aaab
2011
2012 /(?>(a+))b/
2013     aaab
2014
2015 /(?>b)+/
2016     aaabbbccc
2017
2018 /(?>a+|b+|c+)*c/
2019     aaabbbbccccd
2020
2021 /((?>[^()]+)|\([^()]*\))+/
2022     ((abc(ade)ufh()()x
2023     
2024 /\(((?>[^()]+)|\([^()]+\))+\)/ 
2025     (abc)
2026     (abc(def)xyz)
2027     *** Failers
2028     ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
2029
2030 /a(?-i)b/i
2031     ab
2032     Ab
2033     *** Failers 
2034     aB
2035     AB
2036         
2037 /(a (?x)b c)d e/
2038     a bcd e
2039     *** Failers
2040     a b cd e
2041     abcd e   
2042     a bcde 
2043  
2044 /(a b(?x)c d (?-x)e f)/
2045     a bcde f
2046     *** Failers
2047     abcdef  
2048
2049 /(a(?i)b)c/
2050     abc
2051     aBc
2052     *** Failers
2053     abC
2054     aBC  
2055     Abc
2056     ABc
2057     ABC
2058     AbC
2059     
2060 /a(?i:b)c/
2061     abc
2062     aBc
2063     *** Failers 
2064     ABC
2065     abC
2066     aBC
2067     
2068 /a(?i:b)*c/
2069     aBc
2070     aBBc
2071     *** Failers 
2072     aBC
2073     aBBC
2074     
2075 /a(?=b(?i)c)\w\wd/
2076     abcd
2077     abCd
2078     *** Failers
2079     aBCd
2080     abcD     
2081     
2082 /(?s-i:more.*than).*million/i
2083     more than million
2084     more than MILLION
2085     more \n than Million 
2086     *** Failers
2087     MORE THAN MILLION    
2088     more \n than \n million 
2089
2090 /(?:(?s-i)more.*than).*million/i
2091     more than million
2092     more than MILLION
2093     more \n than Million 
2094     *** Failers
2095     MORE THAN MILLION    
2096     more \n than \n million 
2097     
2098 /(?>a(?i)b+)+c/ 
2099     abc
2100     aBbc
2101     aBBc 
2102     *** Failers
2103     Abc
2104     abAb    
2105     abbC 
2106     
2107 /(?=a(?i)b)\w\wc/
2108     abc
2109     aBc
2110     *** Failers
2111     Ab 
2112     abC
2113     aBC     
2114     
2115 /(?<=a(?i)b)(\w\w)c/
2116     abxxc
2117     aBxxc
2118     *** Failers
2119     Abxxc
2120     ABxxc
2121     abxxC      
2122
2123 /(?:(a)|b)(?(1)A|B)/
2124     aA
2125     bB
2126     *** Failers
2127     aB
2128     bA    
2129
2130 /^(a)?(?(1)a|b)+$/
2131     aa
2132     b
2133     bb  
2134     *** Failers
2135     ab   
2136
2137 /^(?(?=abc)\w{3}:|\d\d)$/
2138     abc:
2139     12
2140     *** Failers
2141     123
2142     xyz    
2143
2144 /^(?(?!abc)\d\d|\w{3}:)$/
2145     abc:
2146     12
2147     *** Failers
2148     123
2149     xyz    
2150     
2151 /(?(?<=foo)bar|cat)/
2152     foobar
2153     cat
2154     fcat
2155     focat   
2156     *** Failers
2157     foocat  
2158
2159 /(?(?<!foo)cat|bar)/
2160     foobar
2161     cat
2162     fcat
2163     focat   
2164     *** Failers
2165     foocat  
2166
2167 /( \( )? [^()]+ (?(1) \) |) /x
2168     abcd
2169     (abcd)
2170     the quick (abcd) fox
2171     (abcd   
2172
2173 /( \( )? [^()]+ (?(1) \) ) /x
2174     abcd
2175     (abcd)
2176     the quick (abcd) fox
2177     (abcd   
2178
2179 /^(?(2)a|(1)(2))+$/
2180     12
2181     12a
2182     12aa
2183     *** Failers
2184     1234    
2185
2186 /((?i)blah)\s+\1/
2187     blah blah
2188     BLAH BLAH
2189     Blah Blah
2190     blaH blaH
2191     *** Failers
2192     blah BLAH
2193     Blah blah      
2194     blaH blah 
2195
2196 /((?i)blah)\s+(?i:\1)/
2197     blah blah
2198     BLAH BLAH
2199     Blah Blah
2200     blaH blaH
2201     blah BLAH
2202     Blah blah      
2203     blaH blah 
2204
2205 /(?>a*)*/
2206     a
2207     aa
2208     aaaa
2209     
2210 /(abc|)+/
2211     abc
2212     abcabc
2213     abcabcabc
2214     xyz      
2215
2216 /([a]*)*/
2217     a
2218     aaaaa 
2219  
2220 /([ab]*)*/
2221     a
2222     b
2223     ababab
2224     aaaabcde
2225     bbbb    
2226  
2227 /([^a]*)*/
2228     b
2229     bbbb
2230     aaa   
2231  
2232 /([^ab]*)*/
2233     cccc
2234     abab  
2235  
2236 /([a]*?)*/
2237     a
2238     aaaa 
2239  
2240 /([ab]*?)*/
2241     a
2242     b
2243     abab
2244     baba   
2245  
2246 /([^a]*?)*/
2247     b
2248     bbbb
2249     aaa   
2250  
2251 /([^ab]*?)*/
2252     c
2253     cccc
2254     baba   
2255  
2256 /(?>a*)*/
2257     a
2258     aaabcde 
2259  
2260 /((?>a*))*/
2261     aaaaa
2262     aabbaa 
2263  
2264 /((?>a*?))*/
2265     aaaaa
2266     aabbaa 
2267
2268 /(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
2269     12-sep-98
2270     12-09-98
2271     *** Failers
2272     sep-12-98
2273         
2274 /(?<=(foo))bar\1/
2275     foobarfoo
2276     foobarfootling 
2277     *** Failers
2278     foobar
2279     barfoo   
2280
2281 /(?i:saturday|sunday)/
2282     saturday
2283     sunday
2284     Saturday
2285     Sunday
2286     SATURDAY
2287     SUNDAY
2288     SunDay
2289     
2290 /(a(?i)bc|BB)x/
2291     abcx
2292     aBCx
2293     bbx
2294     BBx
2295     *** Failers
2296     abcX
2297     aBCX
2298     bbX
2299     BBX               
2300
2301 /^([ab](?i)[cd]|[ef])/
2302     ac
2303     aC
2304     bD
2305     elephant
2306     Europe 
2307     frog
2308     France
2309     *** Failers
2310     Africa     
2311
2312 /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
2313     ab
2314     aBd
2315     xy
2316     xY
2317     zebra
2318     Zambesi
2319     *** Failers
2320     aCD  
2321     XY  
2322
2323 /(?<=foo\n)^bar/m
2324     foo\nbar
2325     *** Failers
2326     bar
2327     baz\nbar   
2328
2329 /(?<=(?<!foo)bar)baz/
2330     barbaz
2331     barbarbaz 
2332     koobarbaz 
2333     *** Failers
2334     baz
2335     foobarbaz 
2336
2337 /The case of aaaaaa is missed out below because I think Perl 5.005_02 gets/
2338 /it wrong; it sets $1 to aaa rather than aa. Compare the following test,/
2339 /where it does set $1 to aa when matching aaaaaa./
2340
2341 /^(a\1?){4}$/
2342     a
2343     aa
2344     aaa
2345     aaaa
2346     aaaaa
2347     aaaaaaa
2348     aaaaaaaa
2349     aaaaaaaaa
2350     aaaaaaaaaa
2351     aaaaaaaaaaa
2352     aaaaaaaaaaaa
2353     aaaaaaaaaaaaa
2354     aaaaaaaaaaaaaa
2355     aaaaaaaaaaaaaaa
2356     aaaaaaaaaaaaaaaa               
2357
2358 /^(a\1?)(a\1?)(a\2?)(a\3?)$/
2359     a
2360     aa
2361     aaa
2362     aaaa
2363     aaaaa
2364     aaaaaa
2365     aaaaaaa
2366     aaaaaaaa
2367     aaaaaaaaa
2368     aaaaaaaaaa
2369     aaaaaaaaaaa
2370     aaaaaaaaaaaa
2371     aaaaaaaaaaaaa
2372     aaaaaaaaaaaaaa
2373     aaaaaaaaaaaaaaa
2374     aaaaaaaaaaaaaaaa               
2375
2376 /The following tests are taken from the Perl 5.005 test suite; some of them/
2377 /are compatible with 5.004, but I'd rather not have to sort them out./
2378
2379 /abc/
2380     abc
2381     xabcy
2382     ababc
2383     *** Failers
2384     xbc
2385     axc
2386     abx
2387
2388 /ab*c/
2389     abc
2390
2391 /ab*bc/
2392     abc
2393     abbc
2394     abbbbc
2395
2396 /.{1}/
2397     abbbbc
2398
2399 /.{3,4}/
2400     abbbbc
2401
2402 /ab{0,}bc/
2403     abbbbc
2404
2405 /ab+bc/
2406     abbc
2407     *** Failers
2408     abc
2409     abq
2410
2411 /ab{1,}bc/
2412
2413 /ab+bc/
2414     abbbbc
2415
2416 /ab{1,}bc/
2417     abbbbc
2418
2419 /ab{1,3}bc/
2420     abbbbc
2421
2422 /ab{3,4}bc/
2423     abbbbc
2424
2425 /ab{4,5}bc/
2426     *** Failers
2427     abq
2428     abbbbc
2429
2430 /ab?bc/
2431     abbc
2432     abc
2433
2434 /ab{0,1}bc/
2435     abc
2436
2437 /ab?bc/
2438
2439 /ab?c/
2440     abc
2441
2442 /ab{0,1}c/
2443     abc
2444
2445 /^abc$/
2446     abc
2447     *** Failers
2448     abbbbc
2449     abcc
2450
2451 /^abc/
2452     abcc
2453
2454 /^abc$/
2455
2456 /abc$/
2457     aabc
2458     *** Failers
2459     aabc
2460     aabcd
2461
2462 /^/
2463     abc
2464
2465 /$/
2466     abc
2467
2468 /a.c/
2469     abc
2470     axc
2471
2472 /a.*c/
2473     axyzc
2474
2475 /a[bc]d/
2476     abd
2477     *** Failers
2478     axyzd
2479     abc
2480
2481 /a[b-d]e/
2482     ace
2483
2484 /a[b-d]/
2485     aac
2486
2487 /a[-b]/
2488     a-
2489
2490 /a[b-]/
2491     a-
2492
2493 /a]/
2494     a]
2495
2496 /a[]]b/
2497     a]b
2498
2499 /a[^bc]d/
2500     aed
2501     *** Failers
2502     abd
2503     abd
2504
2505 /a[^-b]c/
2506     adc
2507
2508 /a[^]b]c/
2509     adc
2510     *** Failers
2511     a-c
2512     a]c
2513
2514 /\ba\b/
2515     a-
2516     -a
2517     -a-
2518
2519 /\by\b/
2520     *** Failers
2521     xy
2522     yz
2523     xyz
2524
2525 /\Ba\B/
2526     *** Failers
2527     a-
2528     -a
2529     -a-
2530
2531 /\By\b/
2532     xy
2533
2534 /\by\B/
2535     yz
2536
2537 /\By\B/
2538     xyz
2539
2540 /\w/
2541     a
2542
2543 /\W/
2544     -
2545     *** Failers
2546     -
2547     a
2548
2549 /a\sb/
2550     a b
2551
2552 /a\Sb/
2553     a-b
2554     *** Failers
2555     a-b
2556     a b
2557
2558 /\d/
2559     1
2560
2561 /\D/
2562     -
2563     *** Failers
2564     -
2565     1
2566
2567 /[\w]/
2568     a
2569
2570 /[\W]/
2571     -
2572     *** Failers
2573     -
2574     a
2575
2576 /a[\s]b/
2577     a b
2578
2579 /a[\S]b/
2580     a-b
2581     *** Failers
2582     a-b
2583     a b
2584
2585 /[\d]/
2586     1
2587
2588 /[\D]/
2589     -
2590     *** Failers
2591     -
2592     1
2593
2594 /ab|cd/
2595     abc
2596     abcd
2597
2598 /()ef/
2599     def
2600
2601 /$b/
2602
2603 /a\(b/
2604     a(b
2605
2606 /a\(*b/
2607     ab
2608     a((b
2609
2610 /a\\b/
2611     a\b
2612
2613 /((a))/
2614     abc
2615
2616 /(a)b(c)/
2617     abc
2618
2619 /a+b+c/
2620     aabbabc
2621
2622 /a{1,}b{1,}c/
2623     aabbabc
2624
2625 /a.+?c/
2626     abcabc
2627
2628 /(a+|b)*/
2629     ab
2630
2631 /(a+|b){0,}/
2632     ab
2633
2634 /(a+|b)+/
2635     ab
2636
2637 /(a+|b){1,}/
2638     ab
2639
2640 /(a+|b)?/
2641     ab
2642
2643 /(a+|b){0,1}/
2644     ab
2645
2646 /[^ab]*/
2647     cde
2648
2649 /abc/
2650     *** Failers
2651     b
2652     
2653
2654 /a*/
2655     
2656
2657 /([abc])*d/
2658     abbbcd
2659
2660 /([abc])*bcd/
2661     abcd
2662
2663 /a|b|c|d|e/
2664     e
2665
2666 /(a|b|c|d|e)f/
2667     ef
2668
2669 /abcd*efg/
2670     abcdefg
2671
2672 /ab*/
2673     xabyabbbz
2674     xayabbbz
2675
2676 /(ab|cd)e/
2677     abcde
2678
2679 /[abhgefdc]ij/
2680     hij
2681
2682 /^(ab|cd)e/
2683
2684 /(abc|)ef/
2685     abcdef
2686
2687 /(a|b)c*d/
2688     abcd
2689
2690 /(ab|ab*)bc/
2691     abc
2692
2693 /a([bc]*)c*/
2694     abc
2695
2696 /a([bc]*)(c*d)/
2697     abcd
2698
2699 /a([bc]+)(c*d)/
2700     abcd
2701
2702 /a([bc]*)(c+d)/
2703     abcd
2704
2705 /a[bcd]*dcdcde/
2706     adcdcde
2707
2708 /a[bcd]+dcdcde/
2709     *** Failers
2710     abcde
2711     adcdcde
2712
2713 /(ab|a)b*c/
2714     abc
2715
2716 /((a)(b)c)(d)/
2717     abcd
2718
2719 /[a-zA-Z_][a-zA-Z0-9_]*/
2720     alpha
2721
2722 /^a(bc+|b[eh])g|.h$/
2723     abh
2724
2725 /(bc+d$|ef*g.|h?i(j|k))/
2726     effgz
2727     ij
2728     reffgz
2729     *** Failers
2730     effg
2731     bcdd
2732
2733 /((((((((((a))))))))))/
2734     a
2735
2736 /((((((((((a))))))))))\10/
2737     aa
2738
2739 /(((((((((a)))))))))/
2740     a
2741
2742 /multiple words of text/
2743     *** Failers
2744     aa
2745     uh-uh
2746
2747 /multiple words/
2748     multiple words, yeah
2749
2750 /(.*)c(.*)/
2751     abcde
2752
2753 /\((.*), (.*)\)/
2754     (a, b)
2755
2756 /[k]/
2757
2758 /abcd/
2759     abcd
2760
2761 /a(bc)d/
2762     abcd
2763
2764 /a[-]?c/
2765     ac
2766
2767 /(abc)\1/
2768     abcabc
2769
2770 /([a-c]*)\1/
2771     abcabc
2772
2773 /(a)|\1/
2774     a
2775     *** Failers
2776     ab
2777     x
2778
2779 /(([a-c])b*?\2)*/
2780     ababbbcbc
2781
2782 /(([a-c])b*?\2){3}/
2783     ababbbcbc
2784
2785 /((\3|b)\2(a)x)+/
2786     aaaxabaxbaaxbbax
2787
2788 /((\3|b)\2(a)){2,}/
2789     bbaababbabaaaaabbaaaabba
2790
2791 /abc/i
2792     ABC
2793     XABCY
2794     ABABC
2795     *** Failers
2796     aaxabxbaxbbx
2797     XBC
2798     AXC
2799     ABX
2800
2801 /ab*c/i
2802     ABC
2803
2804 /ab*bc/i
2805     ABC
2806     ABBC
2807
2808 /ab*?bc/i
2809     ABBBBC
2810
2811 /ab{0,}?bc/i
2812     ABBBBC
2813
2814 /ab+?bc/i
2815     ABBC
2816
2817 /ab+bc/i
2818     *** Failers
2819     ABC
2820     ABQ
2821
2822 /ab{1,}bc/i
2823
2824 /ab+bc/i
2825     ABBBBC
2826
2827 /ab{1,}?bc/i
2828     ABBBBC
2829
2830 /ab{1,3}?bc/i
2831     ABBBBC
2832
2833 /ab{3,4}?bc/i
2834     ABBBBC
2835
2836 /ab{4,5}?bc/i
2837     *** Failers
2838     ABQ
2839     ABBBBC
2840
2841 /ab??bc/i
2842     ABBC
2843     ABC
2844
2845 /ab{0,1}?bc/i
2846     ABC
2847
2848 /ab??bc/i
2849
2850 /ab??c/i
2851     ABC
2852
2853 /ab{0,1}?c/i
2854     ABC
2855
2856 /^abc$/i
2857     ABC
2858     *** Failers
2859     ABBBBC
2860     ABCC
2861
2862 /^abc/i
2863     ABCC
2864
2865 /^abc$/i
2866
2867 /abc$/i
2868     AABC
2869
2870 /^/i
2871     ABC
2872
2873 /$/i
2874     ABC
2875
2876 /a.c/i
2877     ABC
2878     AXC
2879
2880 /a.*?c/i
2881     AXYZC
2882
2883 /a.*c/i
2884     *** Failers
2885     AABC
2886     AXYZD
2887
2888 /a[bc]d/i
2889     ABD
2890
2891 /a[b-d]e/i
2892     ACE
2893     *** Failers
2894     ABC
2895     ABD
2896
2897 /a[b-d]/i
2898     AAC
2899
2900 /a[-b]/i
2901     A-
2902
2903 /a[b-]/i
2904     A-
2905
2906 /a]/i
2907     A]
2908
2909 /a[]]b/i
2910     A]B
2911
2912 /a[^bc]d/i
2913     AED
2914
2915 /a[^-b]c/i
2916     ADC
2917     *** Failers
2918     ABD
2919     A-C
2920
2921 /a[^]b]c/i
2922     ADC
2923
2924 /ab|cd/i
2925     ABC
2926     ABCD
2927
2928 /()ef/i
2929     DEF
2930
2931 /$b/i
2932     *** Failers
2933     A]C
2934     B
2935
2936 /a\(b/i
2937     A(B
2938
2939 /a\(*b/i
2940     AB
2941     A((B
2942
2943 /a\\b/i
2944     A\B
2945
2946 /((a))/i
2947     ABC
2948
2949 /(a)b(c)/i
2950     ABC
2951
2952 /a+b+c/i
2953     AABBABC
2954
2955 /a{1,}b{1,}c/i
2956     AABBABC
2957
2958 /a.+?c/i
2959     ABCABC
2960
2961 /a.*?c/i
2962     ABCABC
2963
2964 /a.{0,5}?c/i
2965     ABCABC
2966
2967 /(a+|b)*/i
2968     AB
2969
2970 /(a+|b){0,}/i
2971     AB
2972
2973 /(a+|b)+/i
2974     AB
2975
2976 /(a+|b){1,}/i
2977     AB
2978
2979 /(a+|b)?/i
2980     AB
2981
2982 /(a+|b){0,1}/i
2983     AB
2984
2985 /(a+|b){0,1}?/i
2986     AB
2987
2988 /[^ab]*/i
2989     CDE
2990
2991 /abc/i
2992
2993 /a*/i
2994     
2995
2996 /([abc])*d/i
2997     ABBBCD
2998
2999 /([abc])*bcd/i
3000     ABCD
3001
3002 /a|b|c|d|e/i
3003     E
3004
3005 /(a|b|c|d|e)f/i
3006     EF
3007
3008 /abcd*efg/i
3009     ABCDEFG
3010
3011 /ab*/i
3012     XABYABBBZ
3013     XAYABBBZ
3014
3015 /(ab|cd)e/i
3016     ABCDE
3017
3018 /[abhgefdc]ij/i
3019     HIJ
3020
3021 /^(ab|cd)e/i
3022     ABCDE
3023
3024 /(abc|)ef/i
3025     ABCDEF
3026
3027 /(a|b)c*d/i
3028     ABCD
3029
3030 /(ab|ab*)bc/i
3031     ABC
3032
3033 /a([bc]*)c*/i
3034     ABC
3035
3036 /a([bc]*)(c*d)/i
3037     ABCD
3038
3039 /a([bc]+)(c*d)/i
3040     ABCD
3041
3042 /a([bc]*)(c+d)/i
3043     ABCD
3044
3045 /a[bcd]*dcdcde/i
3046     ADCDCDE
3047
3048 /a[bcd]+dcdcde/i
3049
3050 /(ab|a)b*c/i
3051     ABC
3052
3053 /((a)(b)c)(d)/i
3054     ABCD
3055
3056 /[a-zA-Z_][a-zA-Z0-9_]*/i
3057     ALPHA
3058
3059 /^a(bc+|b[eh])g|.h$/i
3060     ABH
3061
3062 /(bc+d$|ef*g.|h?i(j|k))/i
3063     EFFGZ
3064     IJ
3065     REFFGZ
3066     *** Failers
3067     ADCDCDE
3068     EFFG
3069     BCDD
3070
3071 /((((((((((a))))))))))/i
3072     A
3073
3074 /((((((((((a))))))))))\10/i
3075     AA
3076
3077 /(((((((((a)))))))))/i
3078     A
3079
3080 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
3081     A
3082
3083 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
3084     C
3085
3086 /multiple words of text/i
3087     *** Failers
3088     AA
3089     UH-UH
3090
3091 /multiple words/i
3092     MULTIPLE WORDS, YEAH
3093
3094 /(.*)c(.*)/i
3095     ABCDE
3096
3097 /\((.*), (.*)\)/i
3098     (A, B)
3099
3100 /[k]/i
3101
3102 /abcd/i
3103     ABCD
3104
3105 /a(bc)d/i
3106     ABCD
3107
3108 /a[-]?c/i
3109     AC
3110
3111 /(abc)\1/i
3112     ABCABC
3113
3114 /([a-c]*)\1/i
3115     ABCABC
3116
3117 /a(?!b)./
3118     abad
3119
3120 /a(?=d)./
3121     abad
3122
3123 /a(?=c|d)./
3124     abad
3125
3126 /a(?:b|c|d)(.)/
3127     ace
3128
3129 /a(?:b|c|d)*(.)/
3130     ace
3131
3132 /a(?:b|c|d)+?(.)/
3133     ace
3134     acdbcdbe
3135
3136 /a(?:b|c|d)+(.)/
3137     acdbcdbe
3138
3139 /a(?:b|c|d){2}(.)/
3140     acdbcdbe
3141
3142 /a(?:b|c|d){4,5}(.)/
3143     acdbcdbe
3144
3145 /a(?:b|c|d){4,5}?(.)/
3146     acdbcdbe
3147
3148 /((foo)|(bar))*/
3149     foobar
3150
3151 /a(?:b|c|d){6,7}(.)/
3152     acdbcdbe
3153
3154 /a(?:b|c|d){6,7}?(.)/
3155     acdbcdbe
3156
3157 /a(?:b|c|d){5,6}(.)/
3158     acdbcdbe
3159
3160 /a(?:b|c|d){5,6}?(.)/
3161     acdbcdbe
3162
3163 /a(?:b|c|d){5,7}(.)/
3164     acdbcdbe
3165
3166 /a(?:b|c|d){5,7}?(.)/
3167     acdbcdbe
3168
3169 /a(?:b|(c|e){1,2}?|d)+?(.)/
3170     ace
3171
3172 /^(.+)?B/
3173     AB
3174
3175 /^([^a-z])|(\^)$/
3176     .
3177
3178 /^[<>]&/
3179     <&OUT
3180
3181 /^(a\1?){4}$/
3182     aaaaaaaaaa
3183     *** Failers
3184     AB
3185     aaaaaaaaa
3186     aaaaaaaaaaa
3187
3188 /^(a(?(1)\1)){4}$/
3189     aaaaaaaaaa
3190     *** Failers
3191     aaaaaaaaa
3192     aaaaaaaaaaa
3193
3194 /(?:(f)(o)(o)|(b)(a)(r))*/
3195     foobar
3196
3197 /(?<=a)b/
3198     ab
3199     *** Failers
3200     cb
3201     b
3202
3203 /(?<!c)b/
3204     ab
3205     b
3206     b
3207
3208 /(?:..)*a/
3209     aba
3210
3211 /(?:..)*?a/
3212     aba
3213
3214 /^(?:b|a(?=(.)))*\1/
3215     abc
3216
3217 /^(){3,5}/
3218     abc
3219
3220 /^(a+)*ax/
3221     aax
3222
3223 /^((a|b)+)*ax/
3224     aax
3225
3226 /^((a|bc)+)*ax/
3227     aax
3228
3229 /(a|x)*ab/
3230     cab
3231
3232 /(a)*ab/
3233     cab
3234
3235 /(?:(?i)a)b/
3236     ab
3237
3238 /((?i)a)b/
3239     ab
3240
3241 /(?:(?i)a)b/
3242     Ab
3243
3244 /((?i)a)b/
3245     Ab
3246
3247 /(?:(?i)a)b/
3248     *** Failers
3249     cb
3250     aB
3251
3252 /((?i)a)b/
3253
3254 /(?i:a)b/
3255     ab
3256
3257 /((?i:a))b/
3258     ab
3259
3260 /(?i:a)b/
3261     Ab
3262
3263 /((?i:a))b/
3264     Ab
3265
3266 /(?i:a)b/
3267     *** Failers
3268     aB
3269     aB
3270
3271 /((?i:a))b/
3272
3273 /(?:(?-i)a)b/i
3274     ab
3275
3276 /((?-i)a)b/i
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     *** Failers
3287     aB
3288     Ab
3289
3290 /((?-i)a)b/i
3291
3292 /(?:(?-i)a)b/i
3293     aB
3294
3295 /((?-i)a)b/i
3296     aB
3297
3298 /(?:(?-i)a)b/i
3299     *** Failers
3300     Ab
3301     AB
3302
3303 /((?-i)a)b/i
3304
3305 /(?-i:a)b/i
3306     ab
3307
3308 /((?-i:a))b/i
3309     ab
3310
3311 /(?-i:a)b/i
3312     aB
3313
3314 /((?-i:a))b/i
3315     aB
3316
3317 /(?-i:a)b/i
3318     *** Failers
3319     AB
3320     Ab
3321
3322 /((?-i:a))b/i
3323
3324 /(?-i:a)b/i
3325     aB
3326
3327 /((?-i:a))b/i
3328     aB
3329
3330 /(?-i:a)b/i
3331     *** Failers
3332     Ab
3333     AB
3334
3335 /((?-i:a))b/i
3336
3337 /((?-i:a.))b/i
3338     *** Failers
3339     AB
3340     a\nB
3341
3342 /((?s-i:a.))b/i
3343     a\nB
3344
3345 /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
3346     cabbbb
3347
3348 /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
3349     caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
3350
3351 /(ab)\d\1/i
3352     Ab4ab
3353     ab4Ab
3354
3355 /foo\w*\d{4}baz/
3356     foobar1234baz
3357
3358 /x(~~)*(?:(?:F)?)?/
3359     x~~
3360
3361 /^a(?#xxx){3}c/
3362     aaac
3363
3364 /^a (?#xxx) (?#yyy) {3}c/x
3365     aaac
3366
3367 /(?<![cd])b/
3368     *** Failers
3369     B\nB
3370     dbcb
3371
3372 /(?<![cd])[ab]/
3373     dbaacb
3374
3375 /(?<!(c|d))b/
3376
3377 /(?<!(c|d))[ab]/
3378     dbaacb
3379
3380 /(?<!cd)[ab]/
3381     cdaccb
3382
3383 /^(?:a?b?)*$/
3384     *** Failers
3385     dbcb
3386     a--
3387
3388 /((?s)^a(.))((?m)^b$)/
3389     a\nb\nc\n
3390
3391 /((?m)^b$)/
3392     a\nb\nc\n
3393
3394 /(?m)^b/
3395     a\nb\n
3396
3397 /(?m)^(b)/
3398     a\nb\n
3399
3400 /((?m)^b)/
3401     a\nb\n
3402
3403 /\n((?m)^b)/
3404     a\nb\n
3405
3406 /((?s).)c(?!.)/
3407     a\nb\nc\n
3408     a\nb\nc\n
3409
3410 /((?s)b.)c(?!.)/
3411     a\nb\nc\n
3412     a\nb\nc\n
3413
3414 /^b/
3415
3416 /()^b/
3417     *** Failers
3418     a\nb\nc\n
3419     a\nb\nc\n
3420
3421 /((?m)^b)/
3422     a\nb\nc\n
3423
3424 /(?(1)a|b)/
3425
3426 /(?(1)b|a)/
3427     a
3428
3429 /(x)?(?(1)a|b)/
3430     *** Failers
3431     a
3432     a
3433
3434 /(x)?(?(1)b|a)/
3435     a
3436
3437 /()?(?(1)b|a)/
3438     a
3439
3440 /()(?(1)b|a)/
3441
3442 /()?(?(1)a|b)/
3443     a
3444
3445 /^(\()?blah(?(1)(\)))$/
3446     (blah)
3447     blah
3448     *** Failers
3449     a
3450     blah)
3451     (blah
3452
3453 /^(\(+)?blah(?(1)(\)))$/
3454     (blah)
3455     blah
3456     *** Failers
3457     blah)
3458     (blah
3459
3460 /(?(?!a)a|b)/
3461
3462 /(?(?!a)b|a)/
3463     a
3464
3465 /(?(?=a)b|a)/
3466     *** Failers
3467     a
3468     a
3469
3470 /(?(?=a)a|b)/
3471     a
3472
3473 /(?=(a+?))(\1ab)/
3474     aaab
3475
3476 /^(?=(a+?))\1ab/
3477
3478 /(\w+:)+/
3479     one:
3480
3481 /$(?<=^(a))/
3482     a
3483
3484 /(?=(a+?))(\1ab)/
3485     aaab
3486
3487 /^(?=(a+?))\1ab/
3488     *** Failers
3489     aaab
3490     aaab
3491
3492 /([\w:]+::)?(\w+)$/
3493     abcd
3494     xy:z:::abcd
3495
3496 /^[^bcd]*(c+)/
3497     aexycd
3498
3499 /(a*)b+/
3500     caab
3501
3502 /([\w:]+::)?(\w+)$/
3503     abcd
3504     xy:z:::abcd
3505     *** Failers
3506     abcd:
3507     abcd:
3508
3509 /^[^bcd]*(c+)/
3510     aexycd
3511
3512 /(>a+)ab/
3513
3514 /(?>a+)b/
3515     aaab
3516
3517 /([[:]+)/
3518     a:[b]:
3519
3520 /([[=]+)/
3521     a=[b]=
3522
3523 /([[.]+)/
3524     a.[b].
3525
3526 /((?>a+)b)/
3527     aaab
3528
3529 /(?>(a+))b/
3530     aaab
3531
3532 /((?>[^()]+)|\([^()]*\))+/
3533     ((abc(ade)ufh()()x
3534
3535 /a\Z/
3536     *** Failers
3537     aaab
3538     a\nb\n
3539
3540 /b\Z/
3541     a\nb\n
3542
3543 /b\z/
3544
3545 /b\Z/
3546     a\nb
3547
3548 /b\z/
3549     a\nb
3550     *** Failers
3551     
3552 /^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
3553     a
3554     abc
3555     a-b
3556     0-9 
3557     a.b
3558     5.6.7  
3559     the.quick.brown.fox
3560     a100.b200.300c  
3561     12-ab.1245 
3562     *** Failers
3563     \
3564     .a
3565     -a
3566     a-
3567     a.  
3568     a_b 
3569     a.-
3570     a..  
3571     ab..bc 
3572     the.quick.brown.fox-
3573     the.quick.brown.fox.
3574     the.quick.brown.fox_
3575     the.quick.brown.fox+       
3576
3577 /(?>.*)(?<=(abcd|wxyz))/
3578     alphabetabcd
3579     endingwxyz
3580     *** Failers
3581     a rather long string that doesn't end with one of them
3582
3583 /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
3584     word cat dog elephant mussel cow horse canary baboon snake shark otherword
3585     word cat dog elephant mussel cow horse canary baboon snake shark
3586   
3587 /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
3588     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
3589
3590 /(?<=\d{3}(?!999))foo/
3591     999foo
3592     123999foo 
3593     *** Failers
3594     123abcfoo
3595     
3596 /(?<=(?!...999)\d{3})foo/
3597     999foo
3598     123999foo 
3599     *** Failers
3600     123abcfoo
3601
3602 /(?<=\d{3}(?!999)...)foo/
3603     123abcfoo
3604     123456foo 
3605     *** Failers
3606     123999foo  
3607     
3608 /(?<=\d{3}...)(?<!999)foo/
3609     123abcfoo   
3610     123456foo 
3611     *** Failers
3612     123999foo  
3613
3614 /<a[\s]+href[\s]*=[\s]*          # find <a href=
3615  ([\"\'])?                       # find single or double quote
3616  (?(1) (.*?)\1 | ([^\s]+))       # if quote found, match up to next matching
3617                                  # quote, otherwise match up to next space
3618 /isx
3619     <a href=abcd xyz
3620     <a href=\"abcd xyz pqr\" cats
3621     <a href=\'abcd xyz pqr\' cats
3622
3623 /<a\s+href\s*=\s*                # find <a href=
3624  (["'])?                         # find single or double quote
3625  (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
3626                                  # quote, otherwise match up to next space
3627 /isx
3628     <a href=abcd xyz
3629     <a href=\"abcd xyz pqr\" cats
3630     <a href       =       \'abcd xyz pqr\' cats
3631
3632 /<a\s+href(?>\s*)=(?>\s*)        # find <a href=
3633  (["'])?                         # find single or double quote
3634  (?(1) (.*?)\1 | (\S+))          # if quote found, match up to next matching
3635                                  # quote, otherwise match up to next space
3636 /isx
3637     <a href=abcd xyz
3638     <a href=\"abcd xyz pqr\" cats
3639     <a href       =       \'abcd xyz pqr\' cats
3640
3641 /((Z)+|A)*/
3642     ZABCDEFG
3643
3644 /(Z()|A)*/
3645     ZABCDEFG
3646
3647 /(Z(())|A)*/
3648     ZABCDEFG
3649
3650 /((?>Z)+|A)*/
3651     ZABCDEFG
3652
3653 /((?>)+|A)*/
3654     ZABCDEFG
3655
3656 /a*/g
3657     abbab
3658
3659 /^[a-\d]/
3660     abcde
3661     -things
3662     0digit
3663     *** Failers
3664     bcdef    
3665
3666 /^[\d-a]/
3667     abcde
3668     -things
3669     0digit
3670     *** Failers
3671     bcdef    
3672     
3673 /[[:space:]]+/
3674     > \x09\x0a\x0c\x0d\x0b<
3675      
3676 /[[:blank:]]+/
3677     > \x09\x0a\x0c\x0d\x0b<
3678      
3679 /[\s]+/
3680     > \x09\x0a\x0c\x0d\x0b<
3681      
3682 /\s+/
3683     > \x09\x0a\x0c\x0d\x0b<
3684      
3685 /a\vb/x
3686     ab
3687
3688 /(?!\A)x/m
3689   a\nxb\n
3690
3691 /(?!^)x/m
3692   a\nxb\n
3693
3694 /abc\Qabc\Eabc/
3695     abcabcabc
3696     
3697 /abc\Q(*+|\Eabc/
3698     abc(*+|abc 
3699
3700 /   abc\Q abc\Eabc/x
3701     abc abcabc
3702     *** Failers
3703     abcabcabc  
3704     
3705 /abc#comment
3706     \Q#not comment
3707     literal\E/x
3708     abc#not comment\n    literal     
3709
3710 /abc#comment
3711     \Q#not comment
3712     literal/x
3713     abc#not comment\n    literal     
3714
3715 /abc#comment
3716     \Q#not comment
3717     literal\E #more comment
3718     /x
3719     abc#not comment\n    literal     
3720
3721 /abc#comment
3722     \Q#not comment
3723     literal\E #more comment/x
3724     abc#not comment\n    literal     
3725
3726 /\Qabc\$xyz\E/
3727     abc\\\$xyz
3728
3729 /\Qabc\E\$\Qxyz\E/
3730     abc\$xyz
3731
3732 /\Gabc/
3733     abc
3734     *** Failers
3735     xyzabc  
3736
3737 /\Gabc./g
3738     abc1abc2xyzabc3
3739
3740 /abc./g
3741     abc1abc2xyzabc3 
3742
3743 /a(?x: b c )d/
3744     XabcdY
3745     *** Failers 
3746     Xa b c d Y 
3747
3748 /((?x)x y z | a b c)/
3749     XabcY
3750     AxyzB 
3751
3752 /(?i)AB(?-i)C/
3753     XabCY
3754     *** Failers
3755     XabcY  
3756
3757 /((?i)AB(?-i)C|D)E/
3758     abCE
3759     DE
3760     *** Failers
3761     abcE
3762     abCe  
3763     dE
3764     De    
3765
3766 /(.*)\d+\1/
3767     abc123abc
3768     abc123bc 
3769
3770 /(.*)\d+\1/s
3771     abc123abc
3772     abc123bc 
3773     
3774 /((.*))\d+\1/
3775     abc123abc
3776     abc123bc  
3777
3778 /-- This tests for an IPv6 address in the form where it can have up to --/
3779 /-- eight components, one and only one of which is empty. This must be --/
3780 /-- an internal component. --/
3781
3782 /^(?!:)                       # colon disallowed at start
3783   (?:                         # start of item
3784     (?: [0-9a-f]{1,4} |       # 1-4 hex digits or
3785     (?(1)0 | () ) )           # if null previously matched, fail; else null
3786     :                         # followed by colon
3787   ){1,7}                      # end item; 1-7 of them required               
3788   [0-9a-f]{1,4} $             # final hex number at end of string
3789   (?(1)|.)                    # check that there was an empty component
3790   /xi
3791     a123::a123
3792     a123:b342::abcd
3793     a123:b342::324e:abcd
3794     a123:ddde:b342::324e:abcd
3795     a123:ddde:b342::324e:dcba:abcd
3796     a123:ddde:9999:b342::324e:dcba:abcd
3797     *** Failers
3798     1:2:3:4:5:6:7:8
3799     a123:bce:ddde:9999:b342::324e:dcba:abcd
3800     a123::9999:b342::324e:dcba:abcd
3801     abcde:2:3:4:5:6:7:8
3802     ::1
3803     abcd:fee0:123::   
3804     :1
3805     1:  
3806
3807 /[z\Qa-d]\E]/
3808     z
3809     a
3810     -
3811     d
3812     ] 
3813     *** Failers
3814     b     
3815
3816 /[\z\C]/
3817     z
3818     C 
3819     
3820 /\M/
3821     M 
3822     
3823 /(a+)*b/
3824     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
3825     
3826 /(?i)reg(?:ul(?:[aä]|ae)r|ex)/
3827     REGular
3828     regulaer
3829     Regex  
3830     regulär 
3831
3832 /Åæåä[à-ÿÀ-ß]+/
3833     Åæåäà
3834     Åæåäÿ
3835     ÅæåäÀ
3836     Åæåäß
3837
3838 /(?<=Z)X./
3839   \x84XAZXB
3840
3841 / End of testinput1 /