testinput1   [plain text]


/the quick brown fox/
    the quick brown fox
    The quick brown FOX
    What do you know about the quick brown fox?
    What do you know about THE QUICK BROWN FOX?

/The quick brown fox/i
    the quick brown fox
    The quick brown FOX
    What do you know about the quick brown fox?
    What do you know about THE QUICK BROWN FOX?

/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
    abcd\t\n\r\f\a\e9;\$\\?caxyz

/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
    abxyzpqrrrabbxyyyypqAzz
    abxyzpqrrrabbxyyyypqAzz
    aabxyzpqrrrabbxyyyypqAzz
    aaabxyzpqrrrabbxyyyypqAzz
    aaaabxyzpqrrrabbxyyyypqAzz
    abcxyzpqrrrabbxyyyypqAzz
    aabcxyzpqrrrabbxyyyypqAzz
    aaabcxyzpqrrrabbxyyyypAzz
    aaabcxyzpqrrrabbxyyyypqAzz
    aaabcxyzpqrrrabbxyyyypqqAzz
    aaabcxyzpqrrrabbxyyyypqqqAzz
    aaabcxyzpqrrrabbxyyyypqqqqAzz
    aaabcxyzpqrrrabbxyyyypqqqqqAzz
    aaabcxyzpqrrrabbxyyyypqqqqqqAzz
    aaaabcxyzpqrrrabbxyyyypqAzz
    abxyzzpqrrrabbxyyyypqAzz
    aabxyzzzpqrrrabbxyyyypqAzz
    aaabxyzzzzpqrrrabbxyyyypqAzz
    aaaabxyzzzzpqrrrabbxyyyypqAzz
    abcxyzzpqrrrabbxyyyypqAzz
    aabcxyzzzpqrrrabbxyyyypqAzz
    aaabcxyzzzzpqrrrabbxyyyypqAzz
    aaaabcxyzzzzpqrrrabbxyyyypqAzz
    aaaabcxyzzzzpqrrrabbbxyyyypqAzz
    aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
    aaabcxyzpqrrrabbxyyyypABzz
    aaabcxyzpqrrrabbxyyyypABBzz
    >>>aaabxyzpqrrrabbxyyyypqAzz
    >aaaabxyzpqrrrabbxyyyypqAzz
    >>>>abcxyzpqrrrabbxyyyypqAzz
    *** Failers
    abxyzpqrrabbxyyyypqAzz
    abxyzpqrrrrabbxyyyypqAzz
    abxyzpqrrrabxyyyypqAzz
    aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
    aaaabcxyzzzzpqrrrabbbxyyypqAzz
    aaabcxyzpqrrrabbxyyyypqqqqqqqAzz

/^(abc){1,2}zz/
    abczz
    abcabczz
    *** Failers
    zz
    abcabcabczz
    >>abczz

/^(b+?|a){1,2}?c/
    bc
    bbc
    bbbc
    bac
    bbac
    aac
    abbbbbbbbbbbc
    bbbbbbbbbbbac
    *** Failers
    aaac
    abbbbbbbbbbbac

/^(b+|a){1,2}c/
    bc
    bbc
    bbbc
    bac
    bbac
    aac
    abbbbbbbbbbbc
    bbbbbbbbbbbac
    *** Failers
    aaac
    abbbbbbbbbbbac

/^(b+|a){1,2}?bc/
    bbc

/^(b*|ba){1,2}?bc/
    babc
    bbabc
    bababc
    *** Failers
    bababbc
    babababc

/^(ba|b*){1,2}?bc/
    babc
    bbabc
    bababc
    *** Failers
    bababbc
    babababc

/^\ca\cA\c[\c{\c:/
    \x01\x01\e;z

/^[ab\]cde]/
    athing
    bthing
    ]thing
    cthing
    dthing
    ething
    *** Failers
    fthing
    [thing
    \\thing

/^[]cde]/
    ]thing
    cthing
    dthing
    ething
    *** Failers
    athing
    fthing

/^[^ab\]cde]/
    fthing
    [thing
    \\thing
    *** Failers
    athing
    bthing
    ]thing
    cthing
    dthing
    ething

/^[^]cde]/
    athing
    fthing
    *** Failers
    ]thing
    cthing
    dthing
    ething

/^\/
    

/^/
    

/^[0-9]+$/
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    100
    *** Failers
    abc

/^.*nter/
    enter
    inter
    uponter

/^xxx[0-9]+$/
    xxx0
    xxx1234
    *** Failers
    xxx

/^.+[0-9][0-9][0-9]$/
    x123
    xx123
    123456
    *** Failers
    123
    x1234

/^.+?[0-9][0-9][0-9]$/
    x123
    xx123
    123456
    *** Failers
    123
    x1234

/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
    abc!pqr=apquxz.ixr.zzz.ac.uk
    *** Failers
    !pqr=apquxz.ixr.zzz.ac.uk
    abc!=apquxz.ixr.zzz.ac.uk
    abc!pqr=apquxz:ixr.zzz.ac.uk
    abc!pqr=apquxz.ixr.zzz.ac.ukk

/:/
    Well, we need a colon: somewhere
    *** Fail if we don't

/([\da-f:]+)$/i
    0abc
    abc
    fed
    E
    ::
    5f03:12C0::932e
    fed def
    Any old stuff
    *** Failers
    0zzz
    gzzz
    fed\x20
    Any old rubbish

/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
    .1.2.3
    A.12.123.0
    *** Failers
    .1.2.3333
    1.2.3
    1234.2.3

/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
    1 IN SOA non-sp1 non-sp2(
    1    IN    SOA    non-sp1    non-sp2   (
    *** Failers
    1IN SOA non-sp1 non-sp2(

/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
    a.
    Z.
    2.
    ab-c.pq-r.
    sxk.zzz.ac.uk.
    x-.y-.
    *** Failers
    -abc.peq.

/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
    *.a
    *.b0-a
    *.c3-b.c
    *.c-a.b-c
    *** Failers
    *.0
    *.a-
    *.a-b.c-
    *.c-a.0-c

/^(?=ab(de))(abd)(e)/
    abde

/^(?!(ab)de|x)(abd)(f)/
    abdf

/^(?=(ab(cd)))(ab)/
    abcd

/^[\da-f](\.[\da-f])*$/i
    a.b.c.d
    A.B.C.D
    a.b.c.1.2.3.C

/^\".*\"\s*(;.*)?$/
    \"1234\"
    \"abcd\" ;
    \"\" ; rhubarb
    *** Failers
    \"1234\" : things

/^$/
    \
    *** Failers

/   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
    ab c
    *** Failers
    abc
    ab cde

/(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
    ab c
    *** Failers
    abc
    ab cde

/^   a\ b[c ]d       $/x
    a bcd
    a b d
    *** Failers
    abcd
    ab d

/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
    abcdefhijklm

/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
    abcdefhijklm

/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
    a+ Z0+\x08\n\x1d\x12

/^[.^$|()*+?{,}]+/
    .^\$(*+)|{?,?}

/^a*\w/
    z
    az
    aaaz
    a
    aa
    aaaa
    a+
    aa+

/^a*?\w/
    z
    az
    aaaz
    a
    aa
    aaaa
    a+
    aa+

/^a+\w/
    az
    aaaz
    aa
    aaaa
    aa+

/^a+?\w/
    az
    aaaz
    aa
    aaaa
    aa+

/^\d{8}\w{2,}/
    1234567890
    12345678ab
    12345678__
    *** Failers
    1234567

/^[aeiou\d]{4,5}$/
    uoie
    1234
    12345
    aaaaa
    *** Failers
    123456

/^[aeiou\d]{4,5}?/
    uoie
    1234
    12345
    aaaaa
    123456

/\A(abc|def)=(\1){2,3}\Z/
    abc=abcabc
    def=defdefdef
    *** Failers
    abc=defdef

/^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
    abcdefghijkcda2
    abcdefghijkkkkcda2

/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
    cataract cataract23
    catatonic catatonic23
    caterpillar caterpillar23


/^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]/
    From abcd  Mon Sep 01 12:33:02 1997

/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
    From abcd  Mon Sep 01 12:33:02 1997
    From abcd  Mon Sep  1 12:33:02 1997
    *** Failers
    From abcd  Sep 01 12:33:02 1997

/^12.34/s
    12\n34
    12\r34

/\w+(?=\t)/
    the quick brown\t fox

/foo(?!bar)(.*)/
    foobar is foolish see?

/(?:(?!foo)...|^.{0,2})bar(.*)/
    foobar crowbar etc
    barrel
    2barrel
    A barrel

/^(\D*)(?=\d)(?!123)/
    abc456
    *** Failers
    abc123

/^1234(?# test newlines
  inside)/
    1234

/^1234 #comment in extended re
  /x
    1234

/#rhubarb
  abcd/x
    abcd

/^abcd#rhubarb/x
    abcd

/^(a)\1{2,3}(.)/
    aaab
    aaaab
    aaaaab
    aaaaaab

/(?!^)abc/
    the abc
    *** Failers
    abc

/(?=^)abc/
    abc
    *** Failers
    the abc

/^[ab]{1,3}(ab*|b)/
    aabbbbb

/^[ab]{1,3}?(ab*|b)/
    aabbbbb

/^[ab]{1,3}?(ab*?|b)/
    aabbbbb

/^[ab]{1,3}(ab*?|b)/
    aabbbbb

/  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*                          # optional leading comment
(?:    (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
" (?:                      # opening quote...
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
|                     #    or
\\ [^\x80-\xff]           #   Escaped something (something != CR)
)* "  # closing quote
)                    # initial word
(?:  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  \.  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*   (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
" (?:                      # opening quote...
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
|                     #    or
\\ [^\x80-\xff]           #   Escaped something (something != CR)
)* "  # closing quote
)  )* # further okay, if led by a period
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  @  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*    (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                           # initial subdomain
(?:                                  #
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  \.                        # if led by a period...
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*   (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                     #   ...further okay
)*
# address
|                     #  or
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
" (?:                      # opening quote...
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
|                     #    or
\\ [^\x80-\xff]           #   Escaped something (something != CR)
)* "  # closing quote
)             # one word, optionally followed by....
(?:
[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
\(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)       |  # comments, or...

" (?:                      # opening quote...
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
|                     #    or
\\ [^\x80-\xff]           #   Escaped something (something != CR)
)* "  # closing quote
# quoted strings
)*
<  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*                     # leading <
(?:  @  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*    (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                           # initial subdomain
(?:                                  #
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  \.                        # if led by a period...
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*   (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                     #   ...further okay
)*

(?:  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  ,  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  @  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*    (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                           # initial subdomain
(?:                                  #
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  \.                        # if led by a period...
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*   (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                     #   ...further okay
)*
)* # further okay, if led by comma
:                                # closing colon
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  )? #       optional route
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
" (?:                      # opening quote...
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
|                     #    or
\\ [^\x80-\xff]           #   Escaped something (something != CR)
)* "  # closing quote
)                    # initial word
(?:  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  \.  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*   (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
" (?:                      # opening quote...
[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
|                     #    or
\\ [^\x80-\xff]           #   Escaped something (something != CR)
)* "  # closing quote
)  )* # further okay, if led by a period
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  @  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*    (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                           # initial subdomain
(?:                                  #
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  \.                        # if led by a period...
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*   (?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|   \[                         # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
\]                        #           ]
)                     #   ...further okay
)*
#       address spec
(?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*  > #                  trailing >
# name and address
)  (?: [\040\t] |  \(
(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
\)  )*                       # optional trailing comment
/x
    Alan Other <user\@dom.ain>
    <user\@dom.ain>
    user\@dom.ain
    \"A. Other\" <user.1234\@dom.ain> (a comment)
    A. Other <user.1234\@dom.ain> (a comment)
    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
    A missing angle <user\@some.where
    *** Failers
    The quick brown fox

/[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional leading comment
(?:
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
# Atom
|                       #  or
"                                     # "
[^\\\x80-\xff\n\015"] *                            #   normal
(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
"                                     #        "
# Quoted string
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
\.
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
# Atom
|                       #  or
"                                     # "
[^\\\x80-\xff\n\015"] *                            #   normal
(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
"                                     #        "
# Quoted string
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# additional words
)*
@
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
(?:
\.
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
)*
# address
|                             #  or
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
# Atom
|                       #  or
"                                     # "
[^\\\x80-\xff\n\015"] *                            #   normal
(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
"                                     #        "
# Quoted string
)
# leading word
[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
(?:
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
|
"                                     # "
[^\\\x80-\xff\n\015"] *                            #   normal
(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
"                                     #        "
) # "special" comment or quoted string
[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
)*
<
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# <
(?:
@
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
(?:
\.
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
)*
(?: ,
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
@
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
(?:
\.
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
)*
)*  # additional domains
:
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
)?     #       optional route
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
# Atom
|                       #  or
"                                     # "
[^\\\x80-\xff\n\015"] *                            #   normal
(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
"                                     #        "
# Quoted string
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
\.
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
# Atom
|                       #  or
"                                     # "
[^\\\x80-\xff\n\015"] *                            #   normal
(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
"                                     #        "
# Quoted string
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# additional words
)*
@
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
(?:
\.
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
(?:
[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
|
\[                            # [
(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
\]                           #           ]
)
[\040\t]*                    # Nab whitespace.
(?:
\(                              #  (
[^\\\x80-\xff\n\015()] *                             #     normal*
(?:                                 #       (
(?:  \\ [^\x80-\xff]  |
\(                            #  (
[^\\\x80-\xff\n\015()] *                            #     normal*
(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
\)                           #                       )
)    #         special
[^\\\x80-\xff\n\015()] *                         #         normal*
)*                                  #            )*
\)                             #                )
[\040\t]* )*    # If comment found, allow more spaces.
# optional trailing comments
)*
#       address spec
>                    #                 >
# name and address
)
/x
    Alan Other <user\@dom.ain>
    <user\@dom.ain>
    user\@dom.ain
    \"A. Other\" <user.1234\@dom.ain> (a comment)
    A. Other <user.1234\@dom.ain> (a comment)
    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
    A missing angle <user\@some.where
    *** Failers
    The quick brown fox

/abc\0def\00pqr\000xyz\0000AB/
    abc\0def\00pqr\000xyz\0000AB
    abc456 abc\0def\00pqr\000xyz\0000ABCDE

/abc\x0def\x00pqr\x000xyz\x0000AB/
    abc\x0def\x00pqr\x000xyz\x0000AB
    abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE

/^[\000-\037]/
    \0A
    \01B
    \037C

/\0*/
    \0\0\0\0

/A\x0{2,3}Z/
    The A\x0\x0Z
    An A\0\x0\0Z
    *** Failers
    A\0Z
    A\0\x0\0\x0Z

/^(cow|)\1(bell)/
    cowcowbell
    bell
    *** Failers
    cowbell

/^\s/
    \040abc
    \x0cabc
    \nabc
    \rabc
    \tabc
    *** Failers
    abc

/^a	b
  
    c/x
    abc

/^(a|)\1*b/
    ab
    aaaab
    b
    *** Failers
    acb

/^(a|)\1+b/
    aab
    aaaab
    b
    *** Failers
    ab

/^(a|)\1?b/
    ab
    aab
    b
    *** Failers
    acb

/^(a|)\1{2}b/
    aaab
    b
    *** Failers
    ab
    aab
    aaaab

/^(a|)\1{2,3}b/
    aaab
    aaaab
    b
    *** Failers
    ab
    aab
    aaaaab

/ab{1,3}bc/
    abbbbc
    abbbc
    abbc
    *** Failers
    abc
    abbbbbc

/([^.]*)\.([^:]*):[T ]+(.*)/
    track1.title:TBlah blah blah

/([^.]*)\.([^:]*):[T ]+(.*)/i
    track1.title:TBlah blah blah

/([^.]*)\.([^:]*):[t ]+(.*)/i
    track1.title:TBlah blah blah

/^[W-c]+$/
    WXY_^abc
    ***Failers
    wxy

/^[W-c]+$/i
    WXY_^abc
    wxy_^ABC

/^[\x3f-\x5F]+$/i
    WXY_^abc
    wxy_^ABC

/^abc$/m
    abc
    qqq\nabc
    abc\nzzz
    qqq\nabc\nzzz

/^abc$/
    abc
    *** Failers
    qqq\nabc
    abc\nzzz
    qqq\nabc\nzzz

/\Aabc\Z/m
    abc
    abc\n 
    *** Failers
    qqq\nabc
    abc\nzzz
    qqq\nabc\nzzz
    
/\A(.)*\Z/s
    abc\ndef

/\A(.)*\Z/m
    *** Failers
    abc\ndef

/(?:b)|(?::+)/
    b::c
    c::b

/[-az]+/
    az-
    *** Failers
    b

/[az-]+/
    za-
    *** Failers
    b

/[a\-z]+/
    a-z
    *** Failers
    b

/[a-z]+/
    abcdxyz

/[\d-]+/
    12-34
    *** Failers
    aaa

/[\d-z]+/
    12-34z
    *** Failers
    aaa

/\x5c/
    \\

/\x20Z/
    the Zoo
    *** Failers
    Zulu

/(abc)\1/i
    abcabc
    ABCabc
    abcABC

/ab{3cd/
    ab{3cd

/ab{3,cd/
    ab{3,cd

/ab{3,4a}cd/
    ab{3,4a}cd

/{4,5a}bc/
    {4,5a}bc

/^a.b/
    a\rb
    *** Failers
    a\nb

/abc$/
    abc
    abc\n
    *** Failers
    abc\ndef

/(abc)\123/
    abc\x53

/(abc)\223/
    abc\x93

/(abc)\323/
    abc\xd3

/(abc)\500/
    abc\x40
    abc\100

/(abc)\5000/
    abc\x400
    abc\x40\x30
    abc\1000
    abc\100\x30
    abc\100\060
    abc\100\60

/abc\81/
    abc\081
    abc\0\x38\x31

/abc\91/
    abc\091
    abc\0\x39\x31

/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
    abcdefghijkllS

/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
    abcdefghijk\12S

/ab\gdef/
    abgdef

/a{0}bc/
    bc

/(a|(bc)){0,0}?xyz/
    xyz

/abc[\10]de/
    abc\010de

/abc[\1]de/
    abc\1de

/(abc)[\1]de/
    abc\1de

/a.b(?s)/
    a\nb

/^([^a])([^\b])([^c]*)([^d]{3,4})/
    baNOTccccd
    baNOTcccd
    baNOTccd
    bacccd
    *** Failers
    anything
    b\bc   
    baccd

/[^a]/
    Abc
  
/[^a]/i
    Abc 

/[^a]+/
    AAAaAbc
  
/[^a]+/i
    AAAaAbc 

/[^a]+/
    bbb\nccc
   
/[^k]$/
    abc
    *** Failers
    abk   
   
/[^k]{2,3}$/
    abc
    kbc
    kabc 
    *** Failers
    abk
    akb
    akk 

/^\d{8,}\@.+[^k]$/
    12345678\@a.b.c.d
    123456789\@x.y.z
    *** Failers
    12345678\@x.y.uk
    1234567\@a.b.c.d       

/(a)\1{8,}/
    aaaaaaaaa
    aaaaaaaaaa
    *** Failers
    aaaaaaa   

/[^a]/
    aaaabcd
    aaAabcd 

/[^a]/i
    aaaabcd
    aaAabcd 

/[^az]/
    aaaabcd
    aaAabcd 

/[^az]/i
    aaaabcd
    aaAabcd 

/\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/
 \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

/P[^*]TAIRE[^*]{1,6}?LL/
    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx

/P[^*]TAIRE[^*]{1,}?LL/
    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx

/(\.\d\d[1-9]?)\d+/
    1.230003938
    1.875000282   
    1.235  
                  
/(\.\d\d((?=0)|\d(?=\d)))/
    1.230003938      
    1.875000282
    *** Failers 
    1.235 
    
/a(?)b/
    ab 
 
/\b(foo)\s+(\w+)/i
    Food is on the foo table
    
/foo(.*)bar/
    The food is under the bar in the barn.
    
/foo(.*?)bar/  
    The food is under the bar in the barn.

/(.*)(\d*)/
    I have 2 numbers: 53147
    
/(.*)(\d+)/
    I have 2 numbers: 53147
 
/(.*?)(\d*)/
    I have 2 numbers: 53147

/(.*?)(\d+)/
    I have 2 numbers: 53147

/(.*)(\d+)$/
    I have 2 numbers: 53147

/(.*?)(\d+)$/
    I have 2 numbers: 53147

/(.*)\b(\d+)$/
    I have 2 numbers: 53147

/(.*\D)(\d+)$/
    I have 2 numbers: 53147

/^\D*(?!123)/
    ABC123
     
/^(\D*)(?=\d)(?!123)/
    ABC445
    *** Failers
    ABC123
    
/^[W-]46]/
    W46]789 
    -46]789
    *** Failers
    Wall
    Zebra
    42
    [abcd] 
    ]abcd[
       
/^[W-\]46]/
    W46]789 
    Wall
    Zebra
    Xylophone  
    42
    [abcd] 
    ]abcd[
    \\backslash 
    *** Failers
    -46]789
    well
    
/\d\d\/\d\d\/\d\d\d\d/
    01/01/2000

/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
  word cat dog elephant mussel cow horse canary baboon snake shark otherword
  word cat dog elephant mussel cow horse canary baboon snake shark

/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
  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

/^(a){0,0}/
    bcd
    abc
    aab     

/^(a){0,1}/
    bcd
    abc
    aab  

/^(a){0,2}/
    bcd
    abc
    aab  

/^(a){0,3}/
    bcd
    abc
    aab
    aaa   

/^(a){0,}/
    bcd
    abc
    aab
    aaa
    aaaaaaaa    

/^(a){1,1}/
    bcd
    abc
    aab  

/^(a){1,2}/
    bcd
    abc
    aab  

/^(a){1,3}/
    bcd
    abc
    aab
    aaa   

/^(a){1,}/
    bcd
    abc
    aab
    aaa
    aaaaaaaa    

/.*\.gif/
    borfle\nbib.gif\nno

/.{0,}\.gif/
    borfle\nbib.gif\nno

/.*\.gif/m
    borfle\nbib.gif\nno

/.*\.gif/s
    borfle\nbib.gif\nno

/.*\.gif/ms
    borfle\nbib.gif\nno
    
/.*$/
    borfle\nbib.gif\nno

/.*$/m
    borfle\nbib.gif\nno

/.*$/s
    borfle\nbib.gif\nno

/.*$/ms
    borfle\nbib.gif\nno
    
/.*$/
    borfle\nbib.gif\nno\n

/.*$/m
    borfle\nbib.gif\nno\n

/.*$/s
    borfle\nbib.gif\nno\n

/.*$/ms
    borfle\nbib.gif\nno\n
    
/(.*X|^B)/
    abcde\n1234Xyz
    BarFoo 
    *** Failers
    abcde\nBar  

/(.*X|^B)/m
    abcde\n1234Xyz
    BarFoo 
    abcde\nBar  

/(.*X|^B)/s
    abcde\n1234Xyz
    BarFoo 
    *** Failers
    abcde\nBar  

/(.*X|^B)/ms
    abcde\n1234Xyz
    BarFoo 
    abcde\nBar  

/(?s)(.*X|^B)/
    abcde\n1234Xyz
    BarFoo 
    *** Failers 
    abcde\nBar  

/(?s:.*X|^B)/
    abcde\n1234Xyz
    BarFoo 
    *** Failers 
    abcde\nBar  

/^.*B/
    **** Failers
    abc\nB
     
/(?s)^.*B/
    abc\nB

/(?m)^.*B/
    abc\nB
     
/(?ms)^.*B/
    abc\nB

/(?ms)^B/
    abc\nB

/(?s)B$/
    B\n

/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
    123456654321
  
/^\d\d\d\d\d\d\d\d\d\d\d\d/
    123456654321 

/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
    123456654321
  
/^[abc]{12}/
    abcabcabcabc
    
/^[a-c]{12}/
    abcabcabcabc
    
/^(a|b|c){12}/
    abcabcabcabc 

/^[abcdefghijklmnopqrstuvwxy0123456789]/
    n
    *** Failers 
    z 

/abcde{0,0}/
    abcd
    *** Failers
    abce  

/ab[cd]{0,0}e/
    abe
    *** Failers
    abcde 
    
/ab(c){0,0}d/
    abd
    *** Failers
    abcd   

/a(b*)/
    a
    ab
    abbbb
    *** Failers
    bbbbb    
    
/ab\d{0}e/
    abe
    *** Failers
    ab1e   
    
/"([^\\"]+|\\.)*"/
    the \"quick\" brown fox
    \"the \\\"quick\\\" brown fox\" 

/.*?/g+
    abc
  
/\b/g+
    abc 

/\b/+g
    abc 

//g
    abc

/<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
  <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>

/a[^a]b/
    acb
    a\nb
    
/a.b/
    acb
    *** Failers 
    a\nb   
    
/a[^a]b/s
    acb
    a\nb  
    
/a.b/s
    acb
    a\nb  

/^(b+?|a){1,2}?c/
    bac
    bbac
    bbbac
    bbbbac
    bbbbbac 

/^(b+|a){1,2}?c/
    bac
    bbac
    bbbac
    bbbbac
    bbbbbac 
    
/(?!\A)x/m
    x\nb\n
    a\bx\n  
    
/\x0{ab}/
    \0{ab} 

/(A|B)*?CD/
    CD 
    
/(A|B)*CD/
    CD 

/(AB)*?\1/
    ABABAB

/(AB)*\1/
    ABABAB
    
/ End of testinput1 /