/-- This set of tests checks the API, internals, and non-Perl stuff for UTF
    support, excluding Unicode properties. However, tests that give different
    results in 8-bit and 16-bit modes are excluded (see tests 16 and 17). --/
    
< forbid W 

/\x{110000}/8DZ

/\o{4200000}/8DZ

/\x{ffffffff}/8

/\o{37777777777}/8

/\x{100000000}/8

/\o{77777777777}/8

/\x{d800}/8

/\o{154000}/8

/\x{dfff}/8

/\o{157777}/8

/\x{d7ff}/8

/\o{153777}/8

/\x{e000}/8

/\o{170000}/8

/^\x{100}a\x{1234}/8
    \x{100}a\x{1234}bcd

/\x{0041}\x{2262}\x{0391}\x{002e}/DZ8
    \x{0041}\x{2262}\x{0391}\x{002e}
    
/.{3,5}X/DZ8
    \x{212ab}\x{212ab}\x{212ab}\x{861}X

/.{3,5}?/DZ8
    \x{212ab}\x{212ab}\x{212ab}\x{861}

/(?<=\C)X/8
    Should produce an error diagnostic
    
/^[ab]/8DZ
    bar
    *** Failers
    c
    \x{ff}
    \x{100}  

/^[^ab]/8DZ
    c
    \x{ff}
    \x{100}  
    *** Failers 
    aaa
  
/\x{100}*(\d+|"(?1)")/8
    1234
    "1234" 
    \x{100}1234
    "\x{100}1234"  
    \x{100}\x{100}12ab 
    \x{100}\x{100}"12" 
    *** Failers 
    \x{100}\x{100}abcd

/\x{100}*/8DZ

/a\x{100}*/8DZ

/ab\x{100}*/8DZ

/\x{100}*A/8DZ
    A

/\x{100}*\d(?R)/8DZ

/[Z\x{100}]/8DZ
    Z\x{100}
    \x{100}
    \x{100}Z
    *** Failers 

/[\x{200}-\x{100}]/8

/[Ā-Ą]/8
    \x{100}
    \x{104}
    *** Failers
    \x{105}
    \x{ff}    

/[z-\x{100}]/8DZ

/[z\Qa-d]Ā\E]/8DZ
    \x{100}
    Ā 

/[\xFF]/DZ
    >\xff<

/[^\xFF]/DZ

/[Ä-Ü]/8
    Ö # Matches without Study
    \x{d6}
    
/[Ä-Ü]/8S
    Ö <-- Same with Study
    \x{d6}
    
/[\x{c4}-\x{dc}]/8 
    Ö # Matches without Study
    \x{d6} 

/[\x{c4}-\x{dc}]/8S
    Ö <-- Same with Study
    \x{d6} 

/[^\x{100}]abc(xyz(?1))/8DZ

/[ab\x{100}]abc(xyz(?1))/8DZ

/(\x{100}(b(?2)c))?/DZ8

/(\x{100}(b(?2)c)){0,2}/DZ8

/(\x{100}(b(?1)c))?/DZ8

/(\x{100}(b(?1)c)){0,2}/DZ8

/\W/8
    A.B
    A\x{100}B 
  
/\w/8
    \x{100}X   

/^\ሴ/8DZ

/\x{100}*\d/8DZ

/\x{100}*\s/8DZ

/\x{100}*\w/8DZ

/\x{100}*\D/8DZ

/\x{100}*\S/8DZ

/\x{100}*\W/8DZ

/()()()()()()()()()()
 ()()()()()()()()()()
 ()()()()()()()()()()
 ()()()()()()()()()()
 A (x) (?41) B/8x
    AxxB     

/^[\x{100}\E-\Q\E\x{150}]/BZ8

/^[\QĀ\E-\QŐ\E]/BZ8

/^abc./mgx8<any>
    abc1 \x0aabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\x0aabc6 \x{0085}abc7 \x{2028}abc8 \x{2029}abc9 JUNK

/abc.$/mgx8<any>
    abc1\x0a abc2\x0b abc3\x0c abc4\x0d abc5\x0d\x0a abc6\x{0085} abc7\x{2028} abc8\x{2029} abc9

/^a\Rb/8<bsr_unicode>
    a\nb
    a\rb
    a\r\nb
    a\x0bb
    a\x0cb
    a\x{85}b   
    a\x{2028}b 
    a\x{2029}b 
    ** Failers
    a\n\rb    

/^a\R*b/8<bsr_unicode>
    ab
    a\nb
    a\rb
    a\r\nb
    a\x0bb
    a\x0c\x{2028}\x{2029}b
    a\x{85}b   
    a\n\rb    
    a\n\r\x{85}\x0cb 

/^a\R+b/8<bsr_unicode>
    a\nb
    a\rb
    a\r\nb
    a\x0bb
    a\x0c\x{2028}\x{2029}b
    a\x{85}b   
    a\n\rb    
    a\n\r\x{85}\x0cb 
    ** Failers
    ab  

/^a\R{1,3}b/8<bsr_unicode>
    a\nb
    a\n\rb
    a\n\r\x{85}b
    a\r\n\r\nb 
    a\r\n\r\n\r\nb 
    a\n\r\n\rb
    a\n\n\r\nb 
    ** Failers
    a\n\n\n\rb
    a\r

/\H\h\V\v/8
    X X\x0a
    X\x09X\x0b
    ** Failers
    \x{a0} X\x0a   
    
/\H*\h+\V?\v{3,4}/8 
    \x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
    \x09\x20\x{a0}\x0a\x0b\x0c\x0d\x0a
    \x09\x20\x{a0}\x0a\x0b\x0c
    ** Failers 
    \x09\x20\x{a0}\x0a\x0b
     
/\H\h\V\v/8
    \x{3001}\x{3000}\x{2030}\x{2028}
    X\x{180e}X\x{85}
    ** Failers
    \x{2009} X\x0a   
    
/\H*\h+\V?\v{3,4}/8 
    \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
    \x09\x{205f}\x{a0}\x0a\x{2029}\x0c\x{2028}\x0a
    \x09\x20\x{202f}\x0a\x0b\x0c
    ** Failers 
    \x09\x{200a}\x{a0}\x{2028}\x0b
     
/[\h]/8BZ
    >\x{1680}

/[\h]{3,}/8BZ
    >\x{1680}\x{180e}\x{2000}\x{2003}\x{200a}\x{202f}\x{205f}\x{3000}<

/[\v]/8BZ

/[\H]/8BZ

/[\V]/8BZ

/.*$/8<any>
    \x{1ec5} 
    
/a\Rb/I8<bsr_anycrlf>
    a\rb
    a\nb
    a\r\nb
    ** Failers
    a\x{85}b
    a\x0bb     

/a\Rb/I8<bsr_unicode>
    a\rb
    a\nb
    a\r\nb
    a\x{85}b
    a\x0bb     
    ** Failers 
    a\x{85}b\<bsr_anycrlf>
    a\x0bb\<bsr_anycrlf>
    
/a\R?b/I8<bsr_anycrlf>
    a\rb
    a\nb
    a\r\nb
    ** Failers
    a\x{85}b
    a\x0bb     

/a\R?b/I8<bsr_unicode>
    a\rb
    a\nb
    a\r\nb
    a\x{85}b
    a\x0bb     
    ** Failers 
    a\x{85}b\<bsr_anycrlf>
    a\x0bb\<bsr_anycrlf>
 
/.*a.*=.b.*/8<ANY>
    QQQ\x{2029}ABCaXYZ=!bPQR
    ** Failers
    a\x{2029}b
    \x61\xe2\x80\xa9\x62 

/[[:a\x{100}b:]]/8

/a[^]b/<JS>8
    a\x{1234}b
    a\nb 
    ** Failers
    ab  
    
/a[^]+b/<JS>8
    aXb
    a\nX\nX\x{1234}b 
    ** Failers
    ab  

/(\x{de})\1/
    \x{de}\x{de}

/X/8f<any> 
    A\x{1ec5}ABCXYZ

/Xa{2,4}b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 
    
/Xa{2,4}?b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 
    
/Xa{2,4}+b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 
    
/X\x{123}{2,4}b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X\x{123}{2,4}?b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X\x{123}{2,4}+b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X\x{123}{2,4}b/8
    Xx\P
    X\x{123}x\P
    X\x{123}\x{123}x\P 
    X\x{123}\x{123}\x{123}x\P
    X\x{123}\x{123}\x{123}\x{123}x\P 
    
/X\x{123}{2,4}?b/8
    Xx\P
    X\x{123}x\P
    X\x{123}\x{123}x\P 
    X\x{123}\x{123}\x{123}x\P
    X\x{123}\x{123}\x{123}\x{123}x\P 
    
/X\x{123}{2,4}+b/8
    Xx\P
    X\x{123}x\P
    X\x{123}\x{123}x\P 
    X\x{123}\x{123}\x{123}x\P
    X\x{123}\x{123}\x{123}\x{123}x\P 
    
/X\d{2,4}b/8
    X\P
    X3\P
    X33\P 
    X333\P
    X3333\P 
    
/X\d{2,4}?b/8
    X\P
    X3\P
    X33\P 
    X333\P
    X3333\P 
    
/X\d{2,4}+b/8
    X\P
    X3\P
    X33\P 
    X333\P
    X3333\P 

/X\D{2,4}b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 
    
/X\D{2,4}?b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 
    
/X\D{2,4}+b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 

/X\D{2,4}b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X\D{2,4}?b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X\D{2,4}+b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 

/X[abc]{2,4}b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 
    
/X[abc]{2,4}?b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 
    
/X[abc]{2,4}+b/8
    X\P
    Xa\P
    Xaa\P 
    Xaaa\P
    Xaaaa\P 

/X[abc\x{123}]{2,4}b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X[abc\x{123}]{2,4}?b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X[abc\x{123}]{2,4}+b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 

/X[^a]{2,4}b/8
    X\P
    Xz\P
    Xzz\P 
    Xzzz\P
    Xzzzz\P 
    
/X[^a]{2,4}?b/8
    X\P
    Xz\P
    Xzz\P 
    Xzzz\P
    Xzzzz\P 
    
/X[^a]{2,4}+b/8
    X\P
    Xz\P
    Xzz\P 
    Xzzz\P
    Xzzzz\P 

/X[^a]{2,4}b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X[^a]{2,4}?b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 
    
/X[^a]{2,4}+b/8
    X\P
    X\x{123}\P
    X\x{123}\x{123}\P 
    X\x{123}\x{123}\x{123}\P
    X\x{123}\x{123}\x{123}\x{123}\P 

/(Y)X\1{2,4}b/8
    YX\P
    YXY\P
    YXYY\P 
    YXYYY\P
    YXYYYY\P 
    
/(Y)X\1{2,4}?b/8
    YX\P
    YXY\P
    YXYY\P 
    YXYYY\P
    YXYYYY\P 
    
/(Y)X\1{2,4}+b/8
    YX\P
    YXY\P
    YXYY\P 
    YXYYY\P
    YXYYYY\P 

/(\x{123})X\1{2,4}b/8
    \x{123}X\P
    \x{123}X\x{123}\P
    \x{123}X\x{123}\x{123}\P 
    \x{123}X\x{123}\x{123}\x{123}\P
    \x{123}X\x{123}\x{123}\x{123}\x{123}\P 
    
/(\x{123})X\1{2,4}?b/8
    \x{123}X\P
    \x{123}X\x{123}\P
    \x{123}X\x{123}\x{123}\P 
    \x{123}X\x{123}\x{123}\x{123}\P
    \x{123}X\x{123}\x{123}\x{123}\x{123}\P 
    
/(\x{123})X\1{2,4}+b/8
    \x{123}X\P
    \x{123}X\x{123}\P
    \x{123}X\x{123}\x{123}\P 
    \x{123}X\x{123}\x{123}\x{123}\P
    \x{123}X\x{123}\x{123}\x{123}\x{123}\P 

/\bthe cat\b/8
    the cat\P
    the cat\P\P

/abcd*/8
    xxxxabcd\P
    xxxxabcd\P\P

/abcd*/i8
    xxxxabcd\P
    xxxxabcd\P\P
    XXXXABCD\P
    XXXXABCD\P\P

/abc\d*/8
    xxxxabc1\P
    xxxxabc1\P\P

/(a)bc\1*/8
    xxxxabca\P
    xxxxabca\P\P

/abc[de]*/8
    xxxxabcde\P
    xxxxabcde\P\P

/X\W{3}X/8
    \PX

/\sxxx\s/8T1
    AB\x{85}xxx\x{a0}XYZ
    AB\x{a0}xxx\x{85}XYZ

/\S \S/8T1
    \x{a2} \x{84} 

'A#хц'8x<any>BZ

'A#хц
  PQ'8x<any>BZ
  
/a+#хaa
  z#XX?/8x<any>BZ 

/a+#хaa
  z#х?/8x<any>BZ 

/\g{A}xxx#bXX(?'A'123)
(?'A'456)/8x<any>BZ

/\g{A}xxx#bх(?'A'123)
(?'A'456)/8x<any>BZ

/^\cģ/8

/(\R*)(.)/s8
    \r\n
    \r\r\n\n\r 
    \r\r\n\n\r\n 

/(\R)*(.)/s8
    \r\n
    \r\r\n\n\r 
    \r\r\n\n\r\n 

/[^\x{1234}]+/iS8I   

/[^\x{1234}]+?/iS8I   

/[^\x{1234}]++/iS8I   

/[^\x{1234}]{2}/iS8I

//<bsr_anycrlf><bsr_unicode>

/f.*/
    \P\Pfor

/f.*/s
    \P\Pfor

/f.*/8
    \P\Pfor

/f.*/8s
    \P\Pfor
    
/\x{d7ff}\x{e000}/8

/\x{d800}/8

/\x{dfff}/8 

/\h+/8
    \x{1681}\x{200b}\x{1680}\x{2000}\x{202f}\x{3000}
    \x{3001}\x{2fff}\x{200a}\x{a0}\x{2000}

/[\h\x{e000}]+/8BZ
    \x{1681}\x{200b}\x{1680}\x{2000}\x{202f}\x{3000}
    \x{3001}\x{2fff}\x{200a}\x{a0}\x{2000}

/\H+/8
    \x{1680}\x{180e}\x{167f}\x{1681}\x{180d}\x{180f}
    \x{2000}\x{200a}\x{1fff}\x{200b}
    \x{202f}\x{205f}\x{202e}\x{2030}\x{205e}\x{2060}
    \x{a0}\x{3000}\x{9f}\x{a1}\x{2fff}\x{3001}

/[\H\x{d7ff}]+/8BZ
    \x{1680}\x{180e}\x{167f}\x{1681}\x{180d}\x{180f}
    \x{2000}\x{200a}\x{1fff}\x{200b}
    \x{202f}\x{205f}\x{202e}\x{2030}\x{205e}\x{2060}
    \x{a0}\x{3000}\x{9f}\x{a1}\x{2fff}\x{3001}

/\v+/8
    \x{2027}\x{2030}\x{2028}\x{2029}
    \x09\x0e\x{84}\x{86}\x{85}\x0a\x0b\x0c\x0d

/[\v\x{e000}]+/8BZ
    \x{2027}\x{2030}\x{2028}\x{2029}
    \x09\x0e\x{84}\x{86}\x{85}\x0a\x0b\x0c\x0d

/\V+/8
    \x{2028}\x{2029}\x{2027}\x{2030}
    \x{85}\x0a\x0b\x0c\x0d\x09\x0e\x{84}\x{86}

/[\V\x{d7ff}]+/8BZ
    \x{2028}\x{2029}\x{2027}\x{2030}
    \x{85}\x0a\x0b\x0c\x0d\x09\x0e\x{84}\x{86}

/\R+/8<bsr_unicode>
    \x{2027}\x{2030}\x{2028}\x{2029}
    \x09\x0e\x{84}\x{86}\x{85}\x0a\x0b\x0c\x0d

/(..)\1/8
    ab\P
    aba\P
    abab\P

/(..)\1/8i
    ab\P
    abA\P
    aBAb\P

/(..)\1{2,}/8
    ab\P
    aba\P
    abab\P
    ababa\P
    ababab\P
    ababab\P\P
    abababa\P
    abababa\P\P

/(..)\1{2,}/8i
    ab\P
    aBa\P
    aBAb\P
    AbaBA\P
    abABAb\P
    aBAbaB\P\P
    abABabA\P
    abaBABa\P\P

/(..)\1{2,}?x/8i
    ab\P
    abA\P
    aBAb\P
    abaBA\P
    abAbaB\P
    abaBabA\P
    abAbABaBx\P

/./8<CRLF>
    \r\P
    \r\P\P 
  
/.{2,3}/8<CRLF>
    \r\P 
    \r\P\P
    \r\r\P
    \r\r\P\P
    \r\r\r\P
    \r\r\r\P\P     

/.{2,3}?/8<CRLF>
    \r\P 
    \r\P\P
    \r\r\P
    \r\r\P\P
    \r\r\r\P
    \r\r\r\P\P     

/[^\x{100}][^\x{1234}][^\x{ffff}][^\x{10000}][^\x{10ffff}]/8BZ

/[^\x{100}][^\x{1234}][^\x{ffff}][^\x{10000}][^\x{10ffff}]/8BZi

/[^\x{100}]*[^\x{10000}]+[^\x{10ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{fffff}]{5,6}+/8BZ

/[^\x{100}]*[^\x{10000}]+[^\x{10ffff}]??[^\x{8000}]{4,}[^\x{7fff}]{2,9}?[^\x{fffff}]{5,6}+/8BZi

/(?<=\x{1234}\x{1234})\bxy/I8

/(?<!^)ETA/8
    ETA

/\u0100/<JS>8BZ

/[\u0100-\u0200]/<JS>8BZ

/\ud800/<JS>8

/^a+[a\x{200}]/8BZ
    aa

/[b-d\x{200}-\x{250}]*[ae-h]?#[\x{200}-\x{250}]{0,8}[\x00-\xff]*#[\x{200}-\x{250}]+[a-z]/8BZ

/[^\xff]*PRUNE:\x{100}abc(xyz(?1))/8DZ

/(?<=\K\x{17f})/8g+
    \x{17f}\x{17f}\x{17f}\x{17f}\x{17f}

/(?<=\K\x{17f})/8G+
    \x{17f}\x{17f}\x{17f}\x{17f}\x{17f}

/-- End of testinput5 --/