; Copyright 2004 Eric Niebler.
;
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

[test1]
str=foobarboo
pat=foo
flg=
br0=foo
[end]

[test2]
str=foobarboo
pat=bar
flg=
br0=bar
[end]

[test3]
str=foobarboo
pat=bat
flg=
[end]

[test4]
str=foobarboo
pat=b.*ar
flg=
br0=bar
[end]

[test5]
str=foobarboo
pat=b.*r
flg=
br0=bar
[end]

[test6]
str=foobarboo
pat=b.*b
flg=
br0=barb
[end]

[test7]
str=foobarboo
pat=b.*o
flg=
br0=barboo
[end]

[test8]
str=foobarboo
pat=b.*oo
flg=
br0=barboo
[end]

[test9]
str=foobarboo
pat=b.+ar
flg=
[end]

[test10]
str=foobarboo
pat=b.+r
flg=
br0=bar
[end]

[test11]
str=foobarboo
pat=b.+b
flg=
br0=barb
[end]

[test12]
str=foobarboo
pat=b.+o
flg=
br0=barboo
[end]

[test13]
str=foobarboo
pat=b.+oo
flg=
br0=barboo
[end]

[test14]
str=foobarboo
pat=^foo
flg=
br0=foo
[end]

[test15]
str=foobarboo
pat=^b.*ar
flg=
[end]

[test16]
str=foobarboo
pat=b.+ar$
flg=
[end]

[test17]
str=foobarboo
pat=b.+o$
flg=
br0=barboo
[end]

[test18]
str=foobarboo
pat=b.+oo$
flg=
br0=barboo
[end]

[test19]
str=+1234.56789F
pat=^([-+]?[0-9]+(\.[0-9]*)?)([CF])$
flg=
br0=+1234.56789F
br1=+1234.56789
br2=.56789
br3=F
[end]

[test20]
str=+1234.56789
pat=(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?
flg=
br0=+1234.56789
br1=+
br2=1234.56789
br3=
br4=
[end]

[test21]
str=-1234.56789
pat=(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?
flg=
br0=-1234.56789
br1=-
br2=1234.56789
br3=
br4=
[end]

[test22]
str=-1234.56789e-123123123
pat=(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?
flg=
br0=-1234.56789e-123123123
br1=-
br2=1234.56789
br3=e-123123123
br4=-
[end]

[test23]
str=-.1234.56789
pat=^(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?$
flg=
[end]

[test24]
str=-1234.56789e-12312e123
pat=^(\+|-)?([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?$
flg=
[end]

[test25]
str=aaaaaaaaac
pat=a*a*a*a*a*b
flg=
[end]

[test26]
str=ThIs iS a TeSt
pat=[a-zA-Z]*
flg=
br0=ThIs
[end]

[test27]
str=a^b
pat=a^b
flg=
[end]

[test28]
str=a^b
pat=a\^b
flg=
br0=a^b
[end]

[test29]
str=a^b
pat=a[^ ]b
flg=
br0=a^b
[end]

[test30]
str=a^b
pat=a[^^]b
flg=
[end]

[test31]
str=a^b
pat=a[^\^]b
flg=
[end]

[test31.1]
str=a^b
pat=a[\^]b
flg=
br0=a^b
[end]

[test32]
str=foobazFOObar
pat=foo(?=bar)
flg=i
br0=FOO
[end]

[test33]
str=foobarFOObaz
pat=foo(?!bar)
flg=i
br0=FOO
[end]

[test34]
str=foobarFOO
pat=foo(?!bar)
flg=i
br0=FOO
[end]

[test35]
str=foobarFOObarfoo
pat=((?>(foo))bar)+
flg=i
br0=foobarFOObar
br1=FOObar
br2=FOO
[end]

[test36]
str=foobar
pat=bar|(foo)
flg=g
br0=foo
br1=foo
br2=bar
br3=
[end]

; These results seem odd to me, but
; it comforms with perl

[test37]
str=foobar
pat=(bar|(foo))+
flg=
br0=foobar
br1=bar
br2=foo
[end]

[test38]
str=foobar
pat=((bar)|foo)+
flg=
br0=foobar
br1=bar
br2=bar
[end]

[test39]
str=foobar
pat=(foo|(bar))+
flg=
br0=foobar
br1=bar
br2=bar
[end]

; These results seem odd to me, but
; it comforms with perl

[test40]
str=foobar
pat=((foo)|bar)+
flg=
br0=foobar
br1=bar
br2=foo
[end]

[test41]
str=foobarFOObarfoo
pat=((?i)FOO)(.*?)\1
flg=
br0=foobarFOObarfoo
br1=foo
br2=barFOObar
[end]

[test42]
str=foobarFOObarfoo
pat=((?i)FOO)(.*?)(?i:\1)
flg=
br0=foobarFOO
br1=foo
br2=bar
[end]

; perl allows this, and it is pretty sick.
; But anything perl can do, I can do, too.[end]

[test42.1]
str=fooFOOOFOOOOObar
pat=(foo|(?i:\1O))+
flg=
br0=fooFOOOFOOOO
br1=FOOOO
[end]

[test43]
str=zoo
pat=^[A-Za-m]
flg=
[end]

[test44]
str=Here is a URL: http://www.cnn.com. OK?
pat=(https?:/|www\.)[\w\./,?@#%!_=~&-]+\w
flg=
br0=http://www.cnn.com
br1=http:/
[end]

[test45]
str=fooooooooo
pat=fo{2,5}
flg=
br0=fooooo
[end]

[test46]
str=fooooooooo
pat=fo{2,5}?
flg=
br0=foo
[end]

[test45.1]
str=fooooooooo
pat=fo{2,5}o
flg=
br0=foooooo
[end]

[test46.1]
str=fooooooooo
pat=fo{2,5}?o
flg=
br0=fooo
[end]

[test47]
str={match this}
pat=^{.*}$
flg=
br0={match this}
[end]

[test48]
str=+-+-
pat=[+-]+
flg=
br0=+-+-
[end]

[test49]
str=+-+-
pat=[-+]+
flg=
br0=+-+-
[end]

[test50]
str=\\05g-9e
pat=[\d-g]+
flg=
br0=05g-9
[end]

[test51]
str=\\05g-9e
pat=[\d-\g]+
flg=
br0=05g-9
[end]

[test52]
str=\\05g-9e
pat=[g-\d]+
flg=
br0=05g-9
[end]

[test53]
str=\\05g-9e
pat=[\g-\d]+
flg=
br0=05g-9
[end]

[test54]
str=aBcdefg\\
pat=[a-\g]+
flg=i
br0=aBcdefg
[end]

[test55]
str=ab/.-ba
pat=[--/]+
flg=
br0=/.-
[end]

[test56]
str=ab+,-ba
pat=[+--]+
flg=
br0=+,-
[end]

[test56.1]
str=aaabbbb----
pat=[b-b]+
flg=
br0=bbbb
[end]

[test57]
str=foobarFOO5
pat=(foo).*\15
flg=i
[end]

[test58]
str=Her number is 804-867-5309.
pat=(?:\d{3}-){2}\d{4}
flg=
br0=804-867-5309
[end]

[test59]
str=foo
pat=fo+
flg=
br0=foo
[end]

; backtrack a group[end]

[test60]
str=fooFOObar
pat=(foo)+foobar
flg=i
br0=fooFOObar
br1=foo
[end]

; nested, matched parens [end]

[test61]
str=this is sublist(now(is(the(time),for(all),good(men))to(come)))ok?
pat=\bsublist\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)
flg=
br0=sublist(now(is(the(time),for(all),good(men))to(come)))
[end]

; nested, matched parens [end]

[test62]
str=this is sublist(now(is(the(time),for(all),good(men))to(come))ok?
pat=\bsublist\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)(?>(?:\((?>[^()]*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)[^()]*)*)\)
flg=
[end]

[test63]
str=foobar
pat=^baz|bar
flg=
br0=bar
[end]

[test64]
str=Now <foo>is</foo> the time for all <BOLD>good</bald> men</bold> to come to the aid of their country.
pat=<(.*?)>(.*?)</(\1)>
flg=ig
sub={$1}$2{/$3}
res=Now {foo}is{/foo} the time for all {BOLD}good</bald> men{/bold} to come to the aid of their country.
br0=<foo>is</foo>
br1=foo
br2=is
br3=foo
br4=<BOLD>good</bald> men</bold>
br5=BOLD
br6=good</bald> men
br7=bold
[end]

[test64.sed]
str=Now <foo>is</foo> the time for all <BOLD>good</bald> men</bold> to come to the aid of their country.
pat=<(.*?)>(.*?)</(\1)>
flg=igd
sub={\1}\2{/\3}
res=Now {foo}is{/foo} the time for all {BOLD}good</bald> men{/bold} to come to the aid of their country.
br0=<foo>is</foo>
br1=foo
br2=is
br3=foo
br4=<BOLD>good</bald> men</bold>
br5=BOLD
br6=good</bald> men
br7=bold
[end]

[test68]
str=Now is the time for all good men to come to the aid of their country.
pat=o
flg=g
sub=O
res=NOw is the time fOr all gOOd men tO cOme tO the aid Of their cOuntry.
br0=o
br1=o
br2=o
br3=o
br4=o
br5=o
br6=o
br7=o
br8=o
[end]

[test69]
str=FooBarfoobar
pat=.*foo
flg=i
br0=FooBarfoo
[end]

[test70]
str=FooBarfoobar
pat=.*boo
flg=i
[end]

[test71]
str=FooBarfoobar
pat=.*boo|bar
flg=i
br0=Bar
[end]

[test72]
str=FooBarfoobar
pat=bar
flg=i
sub=($`$&)
res=Foo(FooBar)foobar
br0=Bar
[end]

[test72.perl]
str=FooBarfoobar
pat=bar
flg=ip
sub=($`$&)
res=Foo(FooBar)foobar
br0=Bar
[end]

[test73]
str=FooBarfoobar
pat=bar
flg=gi
sub=($`$&)
res=Foo(FooBar)foo(FooBarfoobar)
br0=Bar
br1=bar
[end]

[test73.perl]
str=FooBarfoobar
pat=bar
flg=gip
sub=($`$&)
res=Foo(FooBar)foo(FooBarfoobar)
br0=Bar
br1=bar
[end]

[test74]
str=FooBarfoobar
pat=bar
flg=gi
sub=($'$&)
res=Foo(foobarBar)foo(bar)
br0=Bar
br1=bar
[end]

[test74.perl]
str=FooBarfoobar
pat=bar
flg=gip
sub=($'$&)
res=Foo(foobarBar)foo(bar)
br0=Bar
br1=bar
[end]

[test75]
str=fooooo
pat=fo{1,}
flg=
br0=fooooo
[end]

[test76.perl]
str=fOO bAr BaZ
pat=\w+
flg=gp
sub=\L\u$&
res=Foo Bar Baz
br0=fOO
br1=bAr
br2=BaZ
[end]

[test76.all]
str=fOO bAr BaZ
pat=\w+
flg=ga
sub=\L\u$&
res=Foo Bar Baz
br0=fOO
br1=bAr
br2=BaZ
[end]

[test77.perl]
str=fOO bAr BaZ
pat=\w+
flg=gp
sub=a\LA\Ua\Ea
res=aaAa aaAa aaAa
br0=fOO
br1=bAr
br2=BaZ
[end]

[test77.all]
str=fOO bAr BaZ
pat=\w+
flg=ga
sub=a\LA\Ua\Ea
res=aaAa aaAa aaAa
br0=fOO
br1=bAr
br2=BaZ
[end]

[test78]
str=This (has) parens
pat=This (\Q(has)\E) (parens)
flg=
br0=This (has) parens
br1=(has)
br2=parens
[end]

[test79]
str=This (has) parens
pat=This \Q(has) parens\E
flg=
br0=This (has) parens
[end]

[test80]
str=This (has) parens
pat=This \Q(has) parens
flg=
br0=This (has) parens
[end]

;[test81]
;str=THAT IS UPPERCASE is
;pat=IS
;flg=ig
;sub=\Uu\Ql$&\E$&n't
;res=THAT UL$&ISn't UPPERCASE UL$&isn't
;br0=is
;[end]

[test82]
str=abba1234abba
pat=\d+
flg=
br0=1234
[end]

[test83]
str=1234abba1234
pat=\D+
flg=
br0=abba
[end]

[test84]
str=abba1234abba
pat=[\d]+
flg=
br0=1234
[end]

[test85]
str=1234abba1234
pat=[\D]+
flg=
br0=abba
[end]

[test86]
str=abba1234abba
pat=[^\D]+
flg=
br0=1234
[end]

[test87]
str=1234abba1234
pat=[^\d]+
flg=
br0=abba
[end]

[test88]
str=1234abba1234
pat=[\W\D]+
flg=
br0=abba
[end]

[test89]
str=1234(.;)abba
pat=[^\w\d]+
flg=
br0=(.;)
[end]

[test90]
str=(boo[bar]baz)
pat=(\(()|\[()).*?(\)\2|\]\3)
flg=
br0=(boo[bar]baz)
br1=(
br2=
br3=
br4=)
[end]

[test91]
str=[boo(bar)baz]
pat=(\(()|\[()).*?(\)\2|\]\3)
flg=
br0=[boo(bar)baz]
br1=[
br2=
br3=
br4=]
[end]

[test91]
str=[boo[bar]baz]
pat=(\(()|\[()).*?(\)\2|\]\3)
flg=
br0=[boo[bar]
br1=[
br2=
br3=
br4=]
[end]

[test92]
str=foobarfoo
pat=(?<=foo)bar
flg=
br0=bar
[end]

[test93]
str=foobarfoo
pat=(?<=(f.o))bar
flg=
br0=bar
br1=foo
[end]

[test94]
str=foOoo
pat=(?<=(fo))o
flg=i
br0=O
br1=fo
[end]

[test95]
str=fOooo
pat=(?<!(fo))o
flg=i
br0=O
br1=
[end]

[test96]
str=12foo12
pat=[[:alpha:]]+
flg=
br0=foo
[end]

[test97]
str=;12foo12;
pat=[[:alpha:][:digit:]]+
flg=
br0=12foo12
[end]

[test98]
str=aaaa
pat=(?<=())a
flg=
br0=a
br1=
[end]

[test99]
str=ABCabc123foo
pat=(?<=(abc\d{3}))foo
flg=
br0=foo
br1=abc123
[end]

;[test100]
;str=aaAAa
;pat=aa
;flg=gi
;br0=AA
;[end]

;[test101]
;str=aaAAaA
;pat=aa
;flg=gi
;br0=aA
;[end]

;[test102]
;str=foobarFOO
;pat=foo
;flg=ir
;br0=FOO
;[end]

[test103]
str=a\nxb\n
pat=(?!^)x
flg=m
[end]

[test104]
str=a\nxb\n
pat=(?!^)x
flg=
br0=x
[end]

[test105]
str=a\nxb\n
pat=(?!\A)x
flg=m
br0=x
[end]

[test106]
str=(this)
pat=^(?:\(()|())\w+(?:\)\1|\2)$
flg=
br0=(this)
br1=
br2=
[end]

[test107]
str=this
pat=^(?:\(()|())\w+(?:\)\1|\2)$
flg=
br0=this
br1=
br2=
[end]

[test108]
str=this)
pat=^(?:\(()|())\w+(?:\)\1|\2)$
flg=
[end]

[test109]
str=(this
pat=^(?:\(()|())\w+(?:\)\1|\2)$
flg=
[end]

[test110]
str=abba123abba
pat=[[:^alpha:]]+
flg=
br0=123
[end]

[test111]
str=abba123abba
pat=[[:^alpha:][:alpha:]]+
flg=
br0=abba123abba
[end]

[test112]
str=123abba123
pat=[^[:^alpha:]]+
flg=
br0=abba
[end]

;[test113]
;str=123abba123
;pat=[[:alpha:]\y]+
;flg=
;br0=123abba123
;[end]

[test114]
str=abba123abba
pat=[^[:^alnum:][:^digit:]]+
flg=
br0=123
[end]

[test115]
str=aaaaA
pat=^(a\1?){4}$
flg=i
br0=aaaaA
br1=A
[end]

[test116]
str=aaaaAa
pat=^(a\1?){4}$
flg=i
br0=aaaaAa
br1=Aa
[end]

; test for possible infinite recursion

[test117]
str=ab
pat=(a|(?=b)(?R))+
flg=
br0=a
br1=
[end]

[test118]
str=abba
pat=(?R)
flg=
br0=
[end]

[test119]
str=nothere(HE(hehe(a(b(c)))nothere
pat=\(((?>[^()]+)|(?R))*\)
flg=
br0=(a(b(c)))
br1=(b(c))
[end]

[test120]
str=1(abcd)(x(y)z)pqr
pat=\(((?>[^()]+)|(?R))*\)
flg=ga
br0=(abcd)
br1=abcd
br2=(x(y)z)
br3=z
[end]

[test121]
str=()
pat=\((?:(?>[^()]+)|(?R))?\)
flg=
br0=()
[end]

[test122]
str=12(abcde(fsh)xyz(foo(bar))lmno)89
pat=\((?:(?>[^()]+)|(?R))?\)
flg=
br0=(fsh)
[end]

[test123]
str=(ab(xy)cd)
pat=\((((?>[^()]+)|(?R))*)\)
flg=
br0=(ab(xy)cd)
br1=ab(xy)cd
br2=cd
[end]

[test124]
str=(ab(xy)cd)
pat=\((123)?(((?>[^()]+)|(?R))*)\)
flg=
br0=(ab(xy)cd)
br1=
br2=ab(xy)cd
br3=cd
[end]

[test125]
str=(123ab(xy)cd)
pat=\((123)?(((?>[^()]+)|(?R))*)\)
flg=
br0=(123ab(xy)cd)
br1=123
br2=ab(xy)cd
br3=cd
[end]

[test126]
str=(abcd(xyz<p>qrs)123)
pat=\((((?>[^()<>]+)|((?>[^()]+))|(?R))*)\)
flg=
br0=(abcd(xyz<p>qrs)123)
br1=abcd(xyz<p>qrs)123
br2=123
;br3=<p>qrs
br3=
[end]

[test127]
str=foobar
pat=foo(?#This is a comment[)bar
flg=
br0=foobar
[end]

[test128]
str=foobar
pat=^ f oo b ar $
flg=x
br0=foobar
[end]

[test129]
str=foobar
pat=^ f o *
flg=x
br0=foo
[end]

[test129.1]
str=foobar
pat=^ f \157 *
flg=x
br0=foo
[end]

[test130]
str=foo bar
pat=^ f oo\  b ar $
flg=x
br0=foo bar
[end]

[test131]
str=foo bar
pat=^ f oo [ ] b ar $
flg=x
br0=foo bar
[end]

[test132]
str=foo bar
pat=^ ( ? : f oo [ ] b ar ) $ # This is a comment
flg=x
br0=foo bar
[end]

[test133]
str=foo bar
pat=^ f oo [ ] b ar # This is a comment
flg=x
br0=foo bar
[end]

[test134]
str=foo bar#Thisisnotacomment
pat=^ f oo [ ] b ar \# This is not a comment
flg=x
br0=foo bar#Thisisnotacomment
[end]

[test135]
str=f oo b ar
pat=^f o(?x)     o     (?-x) b ar
flg=
br0=f oo b ar
[end]

;[test136]
;str=foofoo
;pat=(?:foo)\1
;flg=
;[end]

[test137]
str=a--
pat=^(a?)*$
flg=
[end]

[test138]
str=a--
pat=^(a?)*?$
flg=
[end]

[test139]
str=bc
pat=^(b?){2}bc$
flg=
br0=bc
br1=
[end]

[test140]
str=bbc
pat=^(b?){2}bc$
flg=
br0=bbc
br1=
[end]

[test141]
str=bbbc
pat=^(b?){2}bc$
flg=
br0=bbbc
br1=b
[end]

[test142]
str=bbbbc
pat=^(b?){2}bc$
flg=
[end]

[test143]
str=bbbbc
pat=^(b?)*d$
flg=
[end]

[test144]
str=bc
pat=^(b?){2}?bc$
flg=
br0=bc
br1=
[end]

[test145]
str=bbc
pat=^(b?){2}?bc$
flg=
br0=bbc
br1=
[end]

[test146]
str=bbbc
pat=^(b?){2}?bc$
flg=
br0=bbbc
br1=b
[end]

[test147]
str=bbbbc
pat=^(b?){2}?bc$
flg=
[end]

[test148]
str=bbbbc
pat=^(b?)*?d$
flg=
[end]

[test149]
str=bc
pat=^(b??){2}bc$
flg=
br0=bc
br1=
[end]

[test150]
str=bbc
pat=^(b??){2}bc$
flg=
br0=bbc
br1=b
[end]

[test151]
str=bbbc
pat=^(b??){2}bc$
flg=
br0=bbbc
br1=b
[end]

[test152]
str=bbbbc
pat=^(b??){2}bc$
flg=
[end]

[test153]
str=bbbbc
pat=^(b??)*d$
flg=
[end]

[test154]
str=bc
pat=^(b??){2}?bc$
flg=
br0=bc
br1=
[end]

[test155]
str=bbc
pat=^(b??){2}?bc$
flg=
br0=bbc
br1=b
[end]

[test156]
str=bbbc
pat=^(b??){2}?bc$
flg=
br0=bbbc
br1=b
[end]

[test157]
str=bbbbc
pat=^(b??){2}?bc$
flg=
[end]

[test158]
str=bbbbc
pat=^(b??)*?d$
flg=
[end]

[test159]
str=bbc
pat=^(|||b)*bc$
flg=
br0=bbc
br1=
[end]

[test160]
str=bbc
pat=^(|||b)*?bc$
flg=
br0=bbc
br1=b
[end]

[test161]
str=foo
pat=\w??
sub=<$&>
flg=g
res=<><f><><o><><o><>
br0=
br1=f
br2=
br3=o
br4=
br5=o
br6=
[end]

[test161.sed]
str=foo
pat=\w??
sub=<&>
flg=gd
res=<><f><><o><><o><>
br0=
br1=f
br2=
br3=o
br4=
br5=o
br6=
[end]

[test162]
str=foo
pat=()
sub=<$&>
flg=g
res=<>f<>o<>o<>
br0=
br1=
br2=
br3=
br4=
br5=
br6=
br7=
[end]

[test163]
str=foo
pat=()*
sub=<$&>
flg=g
res=<>f<>o<>o<>
br0=
br1=
br2=
br3=
br4=
br5=
br6=
br7=
[end]

[test164]
str=1yzZ^aAc2
pat=[Z-a]+
flg=i
br0=zZ^aA
[end]

[test165]
str=1yzZ^aAc2
pat=[Z-a]+
flg=
br0=Z^a
[end]

[test166]
str=G
pat=f|(?i)g
flg=
br0=G
[end]

[test167]
str=aBBa
pat=[[:lower:]]+
flg=i
br0=aBBa
[end]

[test168]
str=aA
pat=\x61+
flg=i
br0=aA
[end]

[test169]
str=aA
pat=[\x61]+
flg=i
br0=aA
[end]

[test170]
str=aA
pat=\u0061+
flg=i
br0=aA
[end]

[test171]
str=aA
pat=[\u0061]+
flg=i
br0=aA
[end]

; Test for backreferences over 9
[test172]
str=hellohello
pat=()()()()()()()()()()()(hello)\12
br0=hellohello
br1=
br2=
br3=
br4=
br5=
br6=
br7=
br8=
br9=
br10=
br11=
br12=hello
[end]

; test for named captures
[test173]
str=hellohello
pat=(?P<this>he(ll)o)(?P=this)
br0=hellohello
br1=hello
br2=ll
[end]

; test for named captures
[test174]
str=hellohello
pat=(?P<this>he(ll)o)(?P=this)
flg=p
sub=\u\g<this>, world
res=Hello, world
br0=hellohello
br1=hello
br2=ll
[end]

; test for quantified, non-capturing groups, bug report
[test174]
str=cabba\nabba\ndaba\n
pat=^(c[^\r\n]*(?:\r?\n|\r)(?:(?!c)[^\r\n]*(?:\r?\n|\r))*)
flg=
br0=cabba\nabba\ndaba\n
br1=cabba\nabba\ndaba\n
[end]

; tests pilfered from Boost.Regex test_tricky_cases.cpp

[tricky1]
str=abc
pat=a(((b)))c
flg=g
br0=abc
br1=b
br2=b
br3=b
[end]

[tricky2]
str=abd
pat=a(b|(c))d
flg=g
br0=abd
br1=b
br2=
[end]

[tricky3]
str=acd
pat=a(b|(c))d
flg=g
br0=acd
br1=c
br2=c
[end]

[tricky4]
str=abbd
pat=a(b*|c)d
flg=g
br0=abbd
br1=bb
[end]

[tricky5]
str=aaaaabaaaabaaaabaaaab
pat=a[ab]{20}
flg=g
br0=aaaaabaaaabaaaabaaaab
[end]

[tricky6]
str=aaaaabaaaabaaaabaaaab
pat=a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]
flg=g
br0=aaaaabaaaabaaaabaaaab
[end]

[tricky7]
str=aaaaabaaaabaaaabaaaabweeknights
pat=a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)
flg=g
br0=aaaaabaaaabaaaabaaaabweeknights
br1=wee
br2=knights
[end]

[tricky8]
str=a1234567890123456789012345678901234567890123456789012345678901234567890b
pat=1234567890123456789012345678901234567890123456789012345678901234567890
flg=g
br0=1234567890123456789012345678901234567890123456789012345678901234567890
[end]

[tricky9]
str=xacegikmoq
pat=[ab][cd][ef][gh][ij][kl][mn]
flg=g
br0=acegikm
[end]

[tricky10]
str=xacegikmoq
pat=[ab][cd][ef][gh][ij][kl][mn][op]
flg=g
br0=acegikmo
[end]

[tricky11]
str=xacegikmoqy
pat=[ab][cd][ef][gh][ij][kl][mn][op][qr]
flg=g
br0=acegikmoq
[end]

[tricky12]
str=xacegikmoqy
pat=[ab][cd][ef][gh][ij][kl][mn][op][q]
flg=g
br0=acegikmoq
[end]

[tricky13]
str=zabcdefghi
pat=(a)(b)(c)(d)(e)(f)(g)(h)
flg=g
br0=abcdefgh
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
[end]

[tricky14]
str=zabcdefghij
pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)
flg=g
br0=abcdefghi
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
br9=i
[end]

[tricky15]
str=zabcdefghijk
pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)
flg=g
br0=abcdefghij
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
br9=i
br10=j
[end]

[tricky16]
str=zabcdefghijkl
pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)
flg=g
br0=abcdefghijk
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
br9=i
br10=j
br11=k
[end]

[tricky17]
str=abc
pat=(a)d|(b)c
flg=g
br0=bc
br1=
br2=b
[end]

[tricky18]
str=_wwwnocolon _mailto:
pat=_+((www)|(ftp)|(mailto)):_*
flg=g
br0=_mailto:
br1=mailto
br2=
br3=
br4=mailto
[end]

; Boost.Regex bug
[tricky19]
str=acd
pat=a(b)?c\1d
flg=g
;br0=acd
;br1=
[end]

[tricky20]
str=accd
pat=a(b?c)+d
flg=g
br0=accd
br1=c
[end]

[tricky21]
str=weeknights
pat=(wee|week)(knights|night)
flg=g
br0=weeknights
br1=wee
br2=knights
[end]

[tricky22]
str=abc
pat=.*
flg=g
br0=abc
br1=
[end]

[tricky23]
str=abd
pat=a(b|(c))d
flg=g
br0=abd
br1=b
br2=
[end]

[tricky24]
str=acd
pat=a(b|(c))d
flg=g
br0=acd
br1=c
br2=c
[end]

[tricky25]
str=abbd
pat=a(b*|c|e)d
flg=g
br0=abbd
br1=bb
[end]

[tricky26]
str=acd
pat=a(b*|c|e)d
flg=g
br0=acd
br1=c
[end]

[tricky27]
str=ad
pat=a(b*|c|e)d
flg=g
br0=ad
br1=
[end]

[tricky28]
str=abc
pat=a(b?)c
flg=g
br0=abc
br1=b
[end]

[tricky29]
str=ac
pat=a(b?)c
flg=g
br0=ac
br1=
[end]

[tricky30]
str=abc
pat=a(b+)c
flg=g
br0=abc
br1=b
[end]

[tricky31]
str=abbbc
pat=a(b+)c
flg=g
br0=abbbc
br1=bbb
[end]

[tricky32]
str=ac
pat=a(b*)c
flg=g
br0=ac
br1=
[end]

[tricky33]
str=abcdef
pat=(a|ab)(bc([de]+)f|cde)
flg=g
br0=abcdef
br1=a
br2=bcdef
br3=de
[end]

[tricky34]
str=abc
pat=a([bc]?)c
flg=g
br0=abc
br1=b
[end]

[tricky35]
str=ac
pat=a([bc]?)c
flg=g
br0=ac
br1=
[end]

[tricky36]
str=abc
pat=a([bc]+)c
flg=g
br0=abc
br1=b
[end]

[tricky37]
str=abcc
pat=a([bc]+)c
flg=g
br0=abcc
br1=bc
[end]

[tricky38]
str=abcbc
pat=a([bc]+)bc
flg=g
br0=abcbc
br1=bc
[end]

[tricky39]
str=abb
pat=a(bb+|b)b
flg=g
br0=abb
br1=b
[end]

[tricky40]
str=abb
pat=a(bbb+|bb+|b)b
flg=g
br0=abb
br1=b
[end]

[tricky41]
str=abbb
pat=a(bbb+|bb+|b)b
flg=g
br0=abbb
br1=bb
[end]

[tricky42]
str=abbb
pat=a(bbb+|bb+|b)bb
flg=g
br0=abbb
br1=b
[end]

[tricky43]
str=abcdef
pat=(.*).*
flg=g
br0=abcdef
br1=abcdef
br2=
br3=
[end]

[tricky44]
str=bc
pat=(a*)*
flg=g
br0=
br1=
br2=
br3=
br4=
br5=
[end]

[tricky45]
str=bc
pat=Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+
flg=g
[end]

[tricky46]
str=aaa
pat=Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+
flg=g
br0=aaa
br1=
br2=
br3=
br4=
br5=
br6=
br7=
br8=
br9=
br10=
br11=
br12=
br13=
br14=
br15=
br16=
br17=
br18=
br19=
br20=
br21=
br22=
br23=
br24=
br25=
br26=
br27=
br28=
br29=
br30=
br31=
br32=
br33=
br34=
br35=
br36=
br37=
br38=
br39=
br40=
br41=
br42=
br43=
br44=
br45=
br46=
br47=
br48=
br49=
br50=
br51=
br52=
br53=
br54=
br55=
br56=
br57=
br58=
br59=
br60=
br61=
br62=
br63=
br64=
br65=
br66=
br67=
br68=
br69=
br70=
br71=aaa
[end]

[tricky47]
str=Zaaa
pat=Z(((((((a+)+)+)+)+)+)+)+|Y(((((((a+)+)+)+)+)+)+)+|X(((((((a+)+)+)+)+)+)+)+|W(((((((a+)+)+)+)+)+)+)+|V(((((((a+)+)+)+)+)+)+)+|CZ(((((((a+)+)+)+)+)+)+)+|CY(((((((a+)+)+)+)+)+)+)+|CX(((((((a+)+)+)+)+)+)+)+|CW(((((((a+)+)+)+)+)+)+)+|CV(((((((a+)+)+)+)+)+)+)+|(a+)+
flg=g
br0=Zaaa
br1=aaa
br2=aaa
br3=aaa
br4=aaa
br5=aaa
br6=aaa
br7=aaa
br8=
br9=
br10=
br11=
br12=
br13=
br14=
br15=
br16=
br17=
br18=
br19=
br20=
br21=
br22=
br23=
br24=
br25=
br26=
br27=
br28=
br29=
br30=
br31=
br32=
br33=
br34=
br35=
br36=
br37=
br38=
br39=
br40=
br41=
br42=
br43=
br44=
br45=
br46=
br47=
br48=
br49=
br50=
br51=
br52=
br53=
br54=
br55=
br56=
br57=
br58=
br59=
br60=
br61=
br62=
br63=
br64=
br65=
br66=
br67=
br68=
br69=
br70=
br71=
[end]

[tricky48]
str=xyxxxxyxxxz
pat=xyx*xz
flg=g
br0=xyxxxz
[end]

[tricky49]
str=ad
pat=a(b|c)*d
flg=g
br0=ad
br1=
[end]

[tricky50]
str=abcd
pat=a(b|c)*d
flg=g
br0=abcd
br1=c
[end]

[tricky51]
str=abd
pat=a(b|c)+d
flg=g
br0=abd
br1=b
[end]

[tricky52]
str=abcd
pat=a(b|c)+d
flg=g
br0=abcd
br1=c
[end]

[tricky53]
str=ad
pat=a(b|c?)+d
flg=g
br0=ad
br1=
[end]

[tricky54]
str=ad
pat=a(b|c){0,0}d
flg=g
br0=ad
br1=
[end]

[tricky55]
str=ad
pat=a(b|c){0,1}d
flg=g
br0=ad
br1=
[end]

[tricky56]
str=abd
pat=a(b|c){0,1}d
flg=g
br0=abd
br1=b
[end]

[tricky57]
str=ad
pat=a(b|c){0,2}d
flg=g
br0=ad
br1=
[end]

[tricky58]
str=abcd
pat=a(b|c){0,2}d
flg=g
br0=abcd
br1=c
[end]

[tricky59]
str=ad
pat=a(b|c){0,}d
flg=g
br0=ad
br1=
[end]

[tricky60]
str=abcd
pat=a(b|c){0,}d
flg=g
br0=abcd
br1=c
[end]

[tricky61]
str=abd
pat=a(b|c){1,1}d
flg=g
br0=abd
br1=b
[end]

[tricky62]
str=abd
pat=a(b|c){1,2}d
flg=g
br0=abd
br1=b
[end]

[tricky63]
str=abcd
pat=a(b|c){1,2}d
flg=g
br0=abcd
br1=c
[end]

[tricky64]
str=abd
pat=a(b|c){1,}d
flg=g
br0=abd
br1=b
[end]

[tricky65]
str=abcd
pat=a(b|c){1,}d
flg=g
br0=abcd
br1=c
[end]

[tricky66]
str=acbd
pat=a(b|c){2,2}d
flg=g
br0=acbd
br1=b
[end]

[tricky67]
str=abcd
pat=a(b|c){2,2}d
flg=g
br0=abcd
br1=c
[end]

[tricky68]
str=abcd
pat=a(b|c){2,4}d
flg=g
br0=abcd
br1=c
[end]

[tricky69]
str=abcbd
pat=a(b|c){2,4}d
flg=g
br0=abcbd
br1=b
[end]

[tricky70]
str=abcbcd
pat=a(b|c){2,4}d
flg=g
br0=abcbcd
br1=c
[end]

[tricky71]
str=abcd
pat=a(b|c){2,}d
flg=g
br0=abcd
br1=c
[end]

[tricky72]
str=abcbd
pat=a(b|c){2,}d
flg=g
br0=abcbd
br1=b
[end]

[tricky73]
str=abc
pat=a(((b)))c
flg=g
br0=abc
br1=b
br2=b
br3=b
[end]

[tricky74]
str=abd
pat=a(b|(c))d
flg=g
br0=abd
br1=b
br2=
[end]

[tricky75]
str=acd
pat=a(b|(c))d
flg=g
br0=acd
br1=c
br2=c
[end]

[tricky76]
str=abbd
pat=a(b*|c)d
flg=g
br0=abbd
br1=bb
[end]

[tricky77]
str=aaaaabaaaabaaaabaaaab
pat=a[ab]{20}
flg=g
br0=aaaaabaaaabaaaabaaaab
[end]

[tricky78]
str=aaaaabaaaabaaaabaaaab
pat=a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]
flg=g
br0=aaaaabaaaabaaaabaaaab
[end]

[tricky79]
str=aaaaabaaaabaaaabaaaabweeknights
pat=a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)
flg=g
br0=aaaaabaaaabaaaabaaaabweeknights
br1=wee
br2=knights
[end]

[tricky80]
str=a1234567890123456789012345678901234567890123456789012345678901234567890b
pat=1234567890123456789012345678901234567890123456789012345678901234567890
flg=g
br0=1234567890123456789012345678901234567890123456789012345678901234567890
[end]

[tricky81]
str=xacegikmoq
pat=[ab][cd][ef][gh][ij][kl][mn]
flg=g
br0=acegikm
[end]

[tricky82]
str=xacegikmoq
pat=[ab][cd][ef][gh][ij][kl][mn][op]
flg=g
br0=acegikmo
[end]

[tricky83]
str=xacegikmoqy
pat=[ab][cd][ef][gh][ij][kl][mn][op][qr]
flg=g
br0=acegikmoq
[end]

[tricky84]
str=xacegikmoqy
pat=[ab][cd][ef][gh][ij][kl][mn][op][q]
flg=g
br0=acegikmoq
[end]

[tricky85]
str=zabcdefghi
pat=(a)(b)(c)(d)(e)(f)(g)(h)
flg=g
br0=abcdefgh
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
[end]

[tricky86]
str=zabcdefghij
pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)
flg=g
br0=abcdefghi
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
br9=i
[end]

[tricky87]
str=zabcdefghijk
pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)
flg=g
br0=abcdefghij
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
br9=i
br10=j
[end]

[tricky88]
str=zabcdefghijkl
pat=(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)
flg=g
br0=abcdefghijk
br1=a
br2=b
br3=c
br4=d
br5=e
br6=f
br7=g
br8=h
br9=i
br10=j
br11=k
[end]

[tricky89]
str=abc
pat=(a)d|(b)c
flg=g
br0=bc
br1=
br2=b
[end]

[tricky90]
str=_wwwnocolon _mailto:
pat=_+((www)|(ftp)|(mailto)):_*
flg=g
br0=_mailto:
br1=mailto
br2=
br3=
br4=mailto
[end]

[tricky91]
str=accd
pat=a(b?c)+d
flg=g
br0=accd
br1=c
[end]

[tricky92]
str=weeknights
pat=(wee|week)(knights|night)
flg=g
br0=weeknights
br1=wee
br2=knights
[end]

[tricky93]
str=abc
pat=.*
flg=g
br0=abc
br1=
[end]

[tricky94]
str=abd
pat=a(b|(c))d
flg=g
br0=abd
br1=b
br2=
[end]

[tricky95]
str=acd
pat=a(b|(c))d
flg=g
br0=acd
br1=c
br2=c
[end]

[tricky96]
str=abbd
pat=a(b*|c|e)d
flg=g
br0=abbd
br1=bb
[end]

[tricky97]
str=acd
pat=a(b*|c|e)d
flg=g
br0=acd
br1=c
[end]

[tricky98]
str=ad
pat=a(b*|c|e)d
flg=g
br0=ad
br1=
[end]

[tricky99]
str=abc
pat=a(b?)c
flg=g
br0=abc
br1=b
[end]

[tricky100]
str=ac
pat=a(b?)c
flg=g
br0=ac
br1=
[end]

[tricky101]
str=abc
pat=a(b+)c
flg=g
br0=abc
br1=b
[end]

[tricky102]
str=abbbc
pat=a(b+)c
flg=g
br0=abbbc
br1=bbb
[end]

[tricky103]
str=ac
pat=a(b*)c
flg=g
br0=ac
br1=
[end]

[tricky104]
str=abcdef
pat=(a|ab)(bc([de]+)f|cde)
flg=g
br0=abcdef
br1=a
br2=bcdef
br3=de
[end]

[tricky105]
str=abc
pat=a([bc]?)c
flg=g
br0=abc
br1=b
[end]

[tricky106]
str=ac
pat=a([bc]?)c
flg=g
br0=ac
br1=
[end]

[tricky107]
str=abc
pat=a([bc]+)c
flg=g
br0=abc
br1=b
[end]

[tricky108]
str=abcc
pat=a([bc]+)c
flg=g
br0=abcc
br1=bc
[end]

[tricky109]
str=abcbc
pat=a([bc]+)bc
flg=g
br0=abcbc
br1=bc
[end]

[tricky110]
str=abb
pat=a(bb+|b)b
flg=g
br0=abb
br1=b
[end]

[tricky111]
str=abb
pat=a(bbb+|bb+|b)b
flg=g
br0=abb
br1=b
[end]

[tricky112]
str=abbb
pat=a(bbb+|bb+|b)b
flg=g
br0=abbb
br1=bb
[end]

[tricky113]
str=abbb
pat=a(bbb+|bb+|b)bb
flg=g
br0=abbb
br1=b
[end]

[tricky114]
str=abcdef
pat=(.*).*
flg=g
br0=abcdef
br1=abcdef
br2=
br3=
[end]

[tricky115]
str=bc
pat=(a*)*
flg=g
br0=
br1=
br2=
br3=
br4=
br5=
[end]

[tricky116]
str=xyxxxxyxxxz
pat=xyx*xz
flg=g
br0=xyxxxz
[end]

[tricky117]
str=ad
pat=a(b|c)*d
flg=g
br0=ad
br1=
[end]

[tricky118]
str=abcd
pat=a(b|c)*d
flg=g
br0=abcd
br1=c
[end]

[tricky119]
str=abd
pat=a(b|c)+d
flg=g
br0=abd
br1=b
[end]

[tricky120]
str=abcd
pat=a(b|c)+d
flg=g
br0=abcd
br1=c
[end]

[tricky121]
str=ad
pat=a(b|c?)+d
flg=g
br0=ad
br1=
[end]

[tricky122]
str=ad
pat=a(b|c){0,0}d
flg=g
br0=ad
br1=
[end]

[tricky123]
str=ad
pat=a(b|c){0,1}d
flg=g
br0=ad
br1=
[end]

[tricky124]
str=abd
pat=a(b|c){0,1}d
flg=g
br0=abd
br1=b
[end]

[tricky125]
str=ad
pat=a(b|c){0,2}d
flg=g
br0=ad
br1=
[end]

[tricky126]
str=abcd
pat=a(b|c){0,2}d
flg=g
br0=abcd
br1=c
[end]

[tricky127]
str=ad
pat=a(b|c){0,}d
flg=g
br0=ad
br1=
[end]

[tricky128]
str=abcd
pat=a(b|c){0,}d
flg=g
br0=abcd
br1=c
[end]

[tricky129]
str=abd
pat=a(b|c){1,1}d
flg=g
br0=abd
br1=b
[end]

[tricky130]
str=abd
pat=a(b|c){1,2}d
flg=g
br0=abd
br1=b
[end]

[tricky131]
str=abcd
pat=a(b|c){1,2}d
flg=g
br0=abcd
br1=c
[end]

[tricky132]
str=abd
pat=a(b|c){1,}d
flg=g
br0=abd
br1=b
[end]

[tricky133]
str=abcd
pat=a(b|c){1,}d
flg=g
br0=abcd
br1=c
[end]

[tricky134]
str=acbd
pat=a(b|c){2,2}d
flg=g
br0=acbd
br1=b
[end]

[tricky135]
str=abcd
pat=a(b|c){2,2}d
flg=g
br0=abcd
br1=c
[end]

[tricky136]
str=abcd
pat=a(b|c){2,4}d
flg=g
br0=abcd
br1=c
[end]

[tricky137]
str=abcbd
pat=a(b|c){2,4}d
flg=g
br0=abcbd
br1=b
[end]

[tricky138]
str=abcbcd
pat=a(b|c){2,4}d
flg=g
br0=abcbcd
br1=c
[end]

[tricky139]
str=abcd
pat=a(b|c){2,}d
flg=g
br0=abcd
br1=c
[end]

[tricky140]
str=abcbd
pat=a(b|c){2,}d
flg=g
br0=abcbd
br1=b
[end]

[tricky141]
str=abcd
pat=a(b|c?)+d
flg=g
br0=abcd
br1=
[end]

[tricky142]
str=abd
pat=a(b+|((c)*))+d
flg=g
br0=abd
br1=
br2=
br3=
[end]

; Boost.Regex bug
[tricky143]
str=abcd
pat=a(b+|((c)*))+d
flg=g
br0=abcd
br1=
br2=
;br3=c
br3=
[end]

; Boost.Regex bug
[tricky144]
str=abcd
pat=a(b|c?)+d
flg=g
br0=abcd
;br1=c
br1=
[end]

; Boost.Regex bug
[tricky145]
str=abcd
pat=a(b|((c)*))+d
flg=g
br0=abcd
;br1=c
;br2=c
;br3=c
br1=
br2=
br3=
[end]

; Boost.Regex bug
[tricky146]
str=abd
pat=a(b+|((c)*))+d
flg=g
br0=abd
;br1=b
br1=
br2=
br3=
[end]

; Boost.Regex bug
[tricky147]
str=abcd
pat=a(b+|((c)*))+d
flg=g
br0=abcd
;br1=c
;br2=c
;br3=c
br1=
br2=
br3=
[end]

[tricky148]
str=++i //here is a line comment\n
pat=//[^\n]*
flg=g
br0=//here is a line comment
[end]

[tricky149]
str=/* here is a block comment */
pat=/\*([^*]|\*+[^*/])*\*+/
flg=g
br0=/* here is a block comment */
br1= 
[end]

[tricky150]
str=/**/
pat=/\*([^*]|\*+[^*/])*\*+/
flg=g
br0=/**/
br1=
[end]

[tricky151]
str=/***/
pat=/\*([^*]|\*+[^*/])*\*+/
flg=g
br0=/***/
br1=
[end]

[tricky152]
str=/****/
pat=/\*([^*]|\*+[^*/])*\*+/
flg=g
br0=/****/
br1=
[end]

[tricky153]
str=/*****/
pat=/\*([^*]|\*+[^*/])*\*+/
flg=g
br0=/*****/
br1=
[end]

[tricky154]
str=/*****/*/
pat=/\*([^*]|\*+[^*/])*\*+/
flg=g
br0=/*****/
br1=
[end]

[tricky155]
str=#define some_symbol
pat=^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]*
flg=g
br0=#define some_symbol
br1=
[end]

[tricky156]
str=#define some_symbol(x) #x
pat=^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]*
flg=g
br0=#define some_symbol(x) #x
br1=
[end]

[tricky157]
str=#define some_symbol(x) \\  \r\n  foo();\\\r\n   printf(#x);
pat=^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]*
flg=g
br0=#define some_symbol(x) \\  \r\n  foo();\\\r\n   printf(#x);
br1=foo();\\\r\n   
[end]

[tricky158]
str=aaaabab
pat=(aaa)(ab)*
flg=g
br0=aaaabab
br1=aaa
br2=ab
[end]

[tricky159]
str=0xFF
pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
flg=g
br0=0xFF
br1=0xFF
br2=0xFF
br3=
br4=
br5=
br6=
[end]

[tricky160]
str=35
pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
flg=g
br0=35
br1=35
br2=
br3=35
br4=
br5=
br6=
[end]

[tricky161]
str=0xFFu
pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
flg=g
br0=0xFFu
br1=0xFF
br2=0xFF
br3=
br4=
br5=
br6=
[end]

[tricky162]
str=0xFFL
pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
flg=g
br0=0xFFL
br1=0xFF
br2=0xFF
br3=
br4=L
br5=
br6=
[end]

[tricky163]
str=0xFFFFFFFFFFFFFFFFuint64
pat=((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)?
flg=g
br0=0xFFFFFFFFFFFFFFFFuint64
br1=0xFFFFFFFFFFFFFFFF
br2=0xFFFFFFFFFFFFFFFF
br3=
br4=int64
br5=int64
br6=64
[end]

[tricky164]
str='\\x3A'
pat='([^\\']|\\.)*'
flg=g
br0='\\x3A'
br1=A
[end]

[tricky165]
str='\\''
pat='([^\\']|\\.)*'
flg=g
br0='\\''
br1=\\'
[end]

[tricky166]
str='\\n'
pat='([^\\']|\\.)*'
flg=g
br0='\\n'
br1=\\n
[end]

[tricky167]
str=0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}
pat=0123456789@abcdefghijklmnopqrstuvwxyz\[\\\]\^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ\{\|\}
flg=gi
br0=0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}
[end]

[tricky168]
str=A
pat=a
flg=gi
br0=A
[end]

[tricky169]
str=a
pat=A
flg=gi
br0=a
[end]

[tricky170]
str=abcABC
pat=[abc]+
flg=gi
br0=abcABC
[end]

[tricky171]
str=abcABC
pat=[ABC]+
flg=gi
br0=abcABC
[end]

[tricky172]
str=abcABC
pat=[a-z]+
flg=gi
br0=abcABC
[end]

[tricky173]
str=abzANZ
pat=[A-Z]+
flg=gi
br0=abzANZ
[end]

; Boost.Regex bug
;[tricky174]
;str=abzABZ
;pat=[a-Z]+
;flg=gi
;br0=abzABZ
;[end]

[tricky175]
str=abzABZ
pat=[A-z]+
flg=gi
br0=abzABZ
[end]

[tricky176]
str=abyzABYZ
pat=[[:lower:]]+
flg=gi
br0=abyzABYZ
[end]

[tricky177]
str=abzABZ
pat=[[:upper:]]+
flg=gi
br0=abzABZ
[end]

[tricky178]
str=abcZZZ
pat=\w+
flg=gi
br0=abcZZZ
[end]

[tricky179]
str=abyzABYZ
pat=[[:alpha:]]+
flg=gi
br0=abyzABYZ
[end]

[tricky180]
str=09abyzABYZ
pat=[[:alnum:]]+
flg=gi
br0=09abyzABYZ
[end]

[tricky181]
str=(
pat=\(
flg=g
br0=(
[end]

[tricky182]
str=)
pat=\)
flg=g
br0=)
[end]

[tricky183]
str=$
pat=\$
flg=g
br0=$
[end]

[tricky184]
str=^
pat=\^
flg=g
br0=^
[end]

[tricky185]
str=.
pat=\.
flg=g
br0=.
[end]

[tricky186]
str=*
pat=\*
flg=g
br0=*
[end]

[tricky187]
str=+
pat=\+
flg=g
br0=+
[end]

[tricky188]
str=?
pat=\?
flg=g
br0=?
[end]

[tricky189]
str=[
pat=\[
flg=g
br0=[
[end]

[tricky190]
str=]
pat=\]
flg=g
br0=]
[end]

[tricky191]
str=|
pat=\|
flg=g
br0=|
[end]

[tricky192]
str=\\
pat=\\
flg=g
br0=\
[end]

[tricky193]
str=#
pat=#
flg=g
br0=#
[end]

[tricky194]
str=#
pat=\#
flg=g
br0=#
[end]

[tricky195]
str=a-
pat=a-
flg=g
br0=a-
[end]

[tricky196]
str=-
pat=\-
flg=g
br0=-
[end]

[tricky197]
str={
pat=\{
flg=g
br0={
[end]

[tricky198]
str=}
pat=\}
flg=g
br0=}
[end]

[tricky199]
str=0
pat=0
flg=g
br0=0
[end]

[tricky200]
str=1
pat=1
flg=g
br0=1
[end]

[tricky201]
str=9
pat=9
flg=g
br0=9
[end]

[tricky202]
str=b
pat=b
flg=g
br0=b
[end]

[tricky203]
str=B
pat=B
flg=g
br0=B
[end]

[tricky204]
str=<
pat=<
flg=g
br0=<
[end]

[tricky205]
str=>
pat=>
flg=g
br0=>
[end]

[tricky206]
str=w
pat=w
flg=g
br0=w
[end]

[tricky207]
str=W
pat=W
flg=g
br0=W
[end]

[tricky208]
str=`
pat=`
flg=g
br0=`
[end]

[tricky209]
str= 
pat= 
flg=g
br0= 
[end]

[tricky210]
str=\n
pat=\n
flg=g
br0=\n
[end]

[tricky211]
str=,
pat=,
flg=g
br0=,
[end]

[tricky212]
str=a
pat=a
flg=g
br0=a
[end]

[tricky213]
str=f
pat=f
flg=g
br0=f
[end]

[tricky214]
str=n
pat=n
flg=g
br0=n
[end]

[tricky215]
str=r
pat=r
flg=g
br0=r
[end]

[tricky216]
str=t
pat=t
flg=g
br0=t
[end]

[tricky217]
str=v
pat=v
flg=g
br0=v
[end]

[tricky218]
str=c
pat=c
flg=g
br0=c
[end]

[tricky219]
str=x
pat=x
flg=g
br0=x
[end]

[tricky220]
str=:
pat=:
flg=g
br0=:
[end]

[tricky221]
str=w.a.b 
pat=(\.[[:alnum:]]+){2}
flg=g
br0=.a.b
br1=.b
[end]

[tricky222]
str=foobar
pat=(?!foo)bar
flg=g
br0=bar
[end]

[tricky223]
str=??bar
pat=(?!foo)bar
flg=g
br0=bar
[end]

[tricky224]
str=barfoo
pat=(?!foo)bar
flg=g
br0=bar
[end]

[tricky225]
str=bar??
pat=(?!foo)bar
flg=g
br0=bar
[end]

[tricky226]
str=bar
pat=(?!foo)bar
flg=g
br0=bar
[end]

[tricky227]
str=a\nb
pat=a\Z
flg=g
[end]

[tricky228]
str=abc
pat=()
flg=g
br0=
br1=
br2=
br3=
br4=
br5=
br6=
br7=
[end]

[tricky229]
str=abc
pat=^()
flg=g
br0=
br1=
[end]

[tricky230]
str=abc
pat=^()+
flg=g
br0=
br1=
[end]

[tricky231]
str=abc
pat=^(){1}
flg=g
br0=
br1=
[end]

[tricky232]
str=abc
pat=^(){2}
flg=g
br0=
br1=
[end]

[tricky233]
str=abc
pat=^((){2})
flg=g
br0=
br1=
br2=
[end]

[tricky234]
str=a
pat=()\1
flg=g
br0=
br1=
br2=
br3=
[end]

[tricky235]
str=ab
pat=a()\1b
flg=g
br0=ab
br1=
[end]

[tricky236]
str=ab
pat=a()b\1
flg=g
br0=ab
br1=
[end]

[tricky237]
str=abcbc
pat=([a-c]+)\1
flg=g
br0=bcbc
br1=bc
[end]

[tricky238]
str=xxxxxxxxyyyyyyyyab
pat=.+abc
flg=g
[end]

[tricky239]
str=abcdxxxyyyxxxyyy
pat=(.+)\1
flg=g
br0=xxxyyyxxxyyy
br1=xxxyyy
[end]

[tricky240]
str=___________________________________________x
pat=[_]+$
flg=g
[end]

;[tricky241]
;str=abcXYZ
;pat=\l+
;flg=gi
;br0=abcXYZ
;[end]

;[tricky242]
;str=abcXYZ
;pat=\u+
;flg=gi
;br0=abcXYZ
;[end]

; Boost.Regex bug
[tricky243]
str=abcd
pat=a(b|(((c))*))+d
flg=g
br0=abcd
;br1=c
;br2=c
;br3=c
br1=
br2=
br3=
br4=c
[end]

[replace1]
str=acab
pat=(a(c)?)|(b)
flg=iga
sub=(?1(?2(C:):A):B:)
res=C:AB:
br0=ac
br1=ac
br2=c
br3=
br4=a
br5=a
br6=
br7=
br8=b
br9=
br10=
br11=b
[end]

[track2157.1]
str=abc\ndef\nghi
pat=^.+$
flg=m
br0=abc
[end]

[track2157.2]
str=abc\ndef\nghi
pat=.$
flg=m
br0=c
[end]

[track2157.3]
str=abc\ndef\nghi
pat=^.+$
flg=
[end]

[track2157.4]
str=abc\ndef\nghi
pat=.$
flg=
br0=i
[end]

[track2157.5]
str=abc\r\ndef\r\nghi
pat=^.+$
flg=m
br0=abc
[end]

[track2157.6]
str=abc\r\ndef\r\nghi
pat=.$
flg=m
br0=c
[end]

[nocasealternate]
str=common HighLight and Blow this
pat=highlight|blow
flg=ig
sub=<b>$&</b>
res=common <b>HighLight</b> and <b>Blow</b> this
br0=HighLight
br1=Blow
[end]

[track2296]
str=> "" 
pat=(?P<f>.+):(?P<l>[0-9]+):((?P<c>[0-9]+):)?.*
flg=
[end]
