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