
f foooofof                          *(f+(o))
f foooofofx                         *(f*(o))
f foooxfooxofoxfooox                *(f*(o)x)
f ofooofoofofooo                    *(f*(o))
f xfoooofof                         *(f*(o))
f ofoooxoofxoofoooxoofxofo          *(*(of*(o)x)o)
t ffo                               *(f*(o))
t fofo                              *(f*(o))
t fooofoofofooo                     *(f*(o))
t foooofo                           *(f*(o))
t foooofof                          *(f*(o))
t foooxfooxfoxfooox                 *(f*(o)x)
t foooxfooxfxfooox                  *(f*(o)x)
t ofoooxoofxo                       *(*(of*(o)x)o)
t ofoooxoofxoofoooxoofxo            *(*(of*(o)x)o)
t ofoooxoofxoofoooxoofxoo           *(*(of*(o)x)o)
t ofoooxoofxoofoooxoofxooofxofxo    *(*(of*(o)x)o)
t ofxoofxo                          *(*(of*(o)x)o)
t ofxoofxo                          *(*(of*(o)x)o)

t aac    *(@(a))a@(c)
t ac     *(@(a))a@(c)
f c      *(@(a))a@(c)
t aaac   *(@(a))a@(c)
f baaac  *(@(a))a@(c)
t abcd   ?@(a|b)*@(c)d
t abcd   @(ab|a*@(b))*(c)d
t acd    @(ab|a*(b))*(c)d
t abbcd  @(ab|a*(b))*(c)d
t effgz  @(b+(c)d|e*(f)g?|?(h)i@(j|k))
t efgz   @(b+(c)d|e*(f)g?|?(h)i@(j|k))
t egz    @(b+(c)d|e*(f)g?|?(h)i@(j|k))
t egzefffgzbcdij    *(b+(c)d|e*(f)g?|?(h)i@(j|k))
f egz    @(b+(c)d|e+(f)g?|?(h)i@(j|k))
t ofoofo *(of+(o))
t oxfoxoxfox    *(oxf+(ox))
f oxfoxfox      *(oxf+(ox))
t ofoofo        *(of+(o)|f)
# The following is supposed to match only as fo+ofo+ofo
t foofoofo      @(foo|f|fo)*(f|of+(o))
t oofooofo      *(of|oof+(o))
t fffooofoooooffoofffooofff      *(*(f)*(o))
# The following tests backtracking in alternation matches
t fofoofoofofoo *(fo|foo)
# Exclusion
t foo           !(x)
t foo           !(x)*
f foo           !(foo)
t foobar        !(foo)

t foo           !(foo)*
t bar           !(foo)*
t baz           !(foo)*
t foobar        !(foo)*

t moo.cow       !(*.*).!(*.*)
f mad.moo.cow   !(*.*).!(*.*)
f moo           .!(*.*)
f cow           .!(*.*)
f moo.cow       .!(*.*)
f mad.moo.cow   .!(*.*)
f mucca.pazza   mu!(*(c))?.pa!(*(z))?

t fff           !(f)
t ooo           !(f)
t foo           !(f)
f f             !(f)

t fff           *(!(f))
t ooo           *(!(f))
t foo           *(!(f))
f f             *(!(f))

t fff           +(!(f))
t ooo           +(!(f))
t foo           +(!(f))
f f             +(!(f))

t foot          @(!(z*)|*x)
f zoot          @(!(z*)|*x)
t foox          @(!(z*)|*x)
t zoox          @(!(z*)|*x)
t foo           *(!(foo))
f foob          !(foo)b*
t foobb         !(foo)b*

f a.b             !(*.*)
t abb             !(*.*)
t ab              !(*.*)

f a.a           !(*.a|*.b|*.c)
t a.abcd        !(*.a|*.b|*.c)
t a.c.d         !(*.a|*.b|*.c)
t a.            !(*.a|*.b|*.c)
t d.d           !(*.a|*.b|*.c)
t e.e           !(*.a|*.b|*.c)
t f.f           !(*.a|*.b|*.c)
f f.a           !(*.a|*.b|*.c)

t a.abcd        *!(.a|.b|.c)
t a.c.d         *!(.a|.b|.c)
t a.            *!(.a|.b|.c)
t d.d           *!(.a|.b|.c)
t e.e           *!(.a|.b|.c)
t f.f           *!(.a|.b|.c)
t f.a           *!(.a|.b|.c)

t a.abcd        *.!(a|b|c)
t a.c.d         *.!(a|b|c)
t a.            *.!(a|b|c)
t d.d           *.!(a|b|c)
t e.e           *.!(a|b|c)
t f.f           *.!(a|b|c)
f f.a           *.!(a|b|c)

f abd        a!(@(b|B))d
t acd        a!(@(b|B))d

f ab         a!(@(b|B))
f aB         a!(@(b|B))
t ab]        a!(@(b|B))
t aBc        a!(@(b|B))
t abd        a!(@(b|B))
t ac         a!(@(b|B))
t acd        a!(@(b|B))

f a          (a)
t a          *(a)
t a          +(a)
f a          !(a)
t aa         !(a)
f aa         @(a)b
f aab        @(c)b

f ab         a(*b
t a(b        a(*b
t a((b       a(*b
t a((((b     a(*b

t a          ?
f aa         ?
f aab        ?

f a          (b)
t a          ?(a|b)
t a          a?(a|b)
f a          b?(a|b)
t ba         b?(a|b)
f bb         a?(a|b)
f aa         ?
f aab        ?

f a          ??
t aa         ??
f aab        ??

f a          a??b
f aa         a??b
f aab        a??b
t aaab       a??b

t a          a?(x)

t foo.js.js  *.!(js)
f foo.js.js  *.!(js)*
f foo.js.js  *.!(js)+
f foo.js.js  *.!(js)*.!(js)

f a.js         *.!(js)
t a.js.js      *.!(js)
f c.js         *.!(js)
t a.md         *.!(js)
t d.js.d       *.!(js)

f a.js         !(*.js)
f a.js.js      !(*.js)
f c.js         !(*.js)
t a.md         !(*.js)
t d.js.d       !(*.js)

t a.js         *!(.js)
t a.js.js      *!(.js)
t c.js         *!(.js)
t a.md         *!(.js)
t d.js.d       *!(.js)

t a.a            *!(.a|.b|.c)
t a.b            *!(.a|.b|.c)
t a.c            *!(.a|.b|.c)
t a.c.d          *!(.a|.b|.c)
t c.c            *!(.a|.b|.c)
t a.             *!(.a|.b|.c)
t d.d            *!(.a|.b|.c)
t e.e            *!(.a|.b|.c)
t f.f            *!(.a|.b|.c)
t a.abcd         *!(.a|.b|.c)

t b/b.txt        b/!(c).txt
f b/c.txt        b/!(c).txt
f b/cc.txt       b/!(c).txt
f b/ccc.txt      b/!(c).txt

t *(a|b[)        *(a|b\\[)

t parse.y        !(*.c|*.h|Makefile.in|config*|README)
f shell.c        !(*.c|*.h|Makefile.in|config*|README)
t Makefile       !(*.c|*.h|Makefile.in|config*|README)
f Makefile.in    !(*.c|*.h|Makefile.in|config*|README)

f a.a            *.!(a)
t a.b            *.!(a)
t a.a.a          *.!(a)
f c.a            *.!(a)
t a.             *.!(a)
t d.a.d          *.!(a)

f ax             a?(b*)
t ax             ?(a*|b)


t ab                ab**(e|f)
t abcdef            ab**(e|f)
t abef              ab**(e|f)
t abcfef            ab**(e|f)

f ab                ab**(e|f)g
f abcdef            ab**(e|f)g
f abef              ab**(e|f)g
f abcfef            ab**(e|f)g

f ab                ab*+(e|f)
t abcdef            ab*+(e|f)
t abef              ab*+(e|f)
t abcfef            ab*+(e|f)

f ab                ab*d+(e|f)
t abcdef            ab*d+(e|f)
f abef              ab*d+(e|f)
f abcfef            ab*d+(e|f)

f ab                ab?*(e|f)
f abcdef            ab?*(e|f)
t abef              ab?*(e|f)
t abcfef            ab?*(e|f)

f 123abc            ab?*(e|f)
f ab                ab?*(e|f)
f abcdef            ab?*(e|f)
f abcfefg           ab?*(e|f)
t abef              ab?*(e|f)
t abcfef            ab?*(e|f)
t abd               ab?*(e|f)
f acd               ab?*(e|f)

f 123abc            ab*d+(e|f)
f ab                ab*d+(e|f)
t abcdef            ab*d+(e|f)
f abcfefg           ab*d+(e|f)
f abef              ab*d+(e|f)
f abcfef            ab*d+(e|f)
f abd               ab*d+(e|f)
f acd               ab*d+(e|f)

f ab                (a+|b)+
f abcdef            (a+|b)+
f abcfefg           (a+|b)+
f abef              (a+|b)+
f abcfef            (a+|b)+
f abd               (a+|b)+
f acd               (a+|b)+

f b                 (a+|b)*
f zz                (a+|b)*
f abcdef            (a+|b)*
f abcfefg           (a+|b)*
f abef              (a+|b)*
f abcfef            (a+|b)*
f abd               (a+|b)*
f acd               (a+|b)*

f a.a               !(*[a-b].[a-b]*)
f a.b               !(*[a-b].[a-b]*)
f a.a.a             !(*[a-b].[a-b]*)
t c.a               !(*[a-b].[a-b]*)
t d.a.d             !(*[a-b].[a-b]*)
f a.bb              !(*[a-b].[a-b]*)
t a.ccc             !(*[a-b].[a-b]*)
t c.ccc             !(*[a-b].[a-b]*)

f a.a               !(*.[a-b]*)
f a.b               !(*.[a-b]*)
f a.a.a             !(*.[a-b]*)
f c.a               !(*.[a-b]*)
f d.a.d             !(*.[a-b]*)
f a.bb              !(*.[a-b]*)
t a.ccc             !(*.[a-b]*)
t c.ccc             !(*.[a-b]*)

f a.a               !*.(a|b)
f a.b               !*.(a|b)
f a.a.a             !*.(a|b)
f c.a               !*.(a|b)
f d.a.d             !*.(a|b)
f a.bb              !*.(a|b)
f a.ccc             !*.(a|b)

f a.a               !*.(a|b)*
f a.b               !*.(a|b)*
f a.a.a             !*.(a|b)*
f c.a               !*.(a|b)*
f d.a.d             !*.(a|b)*
f a.bb              !*.(a|b)*
f a.ccc             !*.(a|b)*

f a.a               (a|d).(a|b)*
f a.b               (a|d).(a|b)*
f a.bb              (a|d).(a|b)*

f a.a               *.+(b|d)
t a.b               *.+(b|d)
f a.a.a             *.+(b|d)
f c.a               *.+(b|d)
f a.                *.+(b|d)
t d.a.d             *.+(b|d)
t a.bb              *.+(b|d)
f a.ccc             *.+(b|d)
