blob: 3961244c79692ff73e446bed6164929a89b3a509 [file] [log] [blame]
Bram Moolenaar745c6eb2013-09-19 17:04:30 +02001Tests for regexp with multi-byte encoding and various magic settings.
2Test matchstr() with a count and multi-byte chars.
3See test44 for exactly the same test with re=1.
4
5STARTTEST
6:so mbyte.vim
7:set nocompatible encoding=utf-8 termencoding=latin1 viminfo+=nviminfo
8:set re=2
9/^1
10/a*b\{2}c\+/e
11x/\Md\*e\{2}f\+/e
12x:set nomagic
13/g\*h\{2}i\+/e
14x/\mj*k\{2}l\+/e
15x/\vm*n{2}o+/e
16x/\V^aa$
17x:set magic
18/\v(a)(b)\2\1\1/e
19x/\V[ab]\(\[xy]\)\1
20x:" Now search for multi-byte without composing char
21/ม
22x:" Now search for multi-byte with composing char
23/ม่
24x:" find word by change of word class
25/ち\<カヨ\>は
26x:" Test \%u, [\u] and friends
27/\%u20ac
28x/[\u4f7f\u5929]\+
29x/\%U12345678
30x/[\U1234abcd\u1234\uabcd]
31x/\%d21879b
Bram Moolenaar745c6eb2013-09-19 17:04:30 +020032x:" Test backwards search from a multi-byte char
33/x
34x?.
35x:let @w=':%s#comb[i]nations#œ̄ṣ́m̥̄ᾱ̆́#g'
36:@w
Bram Moolenaar96c664a2015-12-31 16:21:52 +010037:"
38:" l Test what 7.3.192 fixed
39/^l
40:s/ \?/ /g
Bram Moolenaar745c6eb2013-09-19 17:04:30 +020041:?^1?,$w! test.out
42:e! test.out
43G:put =matchstr(\"אבגד\", \".\", 0, 2) " ב
44:put =matchstr(\"אבגד\", \"..\", 0, 2) " בג
45:put =matchstr(\"אבגד\", \".\", 0, 0) " א
46:put =matchstr(\"אבגד\", \".\", 4, -1) " ג
47:w!
48:qa!
49ENDTEST
50
511 a aa abb abbccc
522 d dd dee deefff
533 g gg ghh ghhiii
544 j jj jkk jkklll
555 m mm mnn mnnooo
566 x ^aa$ x
577 (a)(b) abbaa
588 axx [ab]xx
599 หม่x อมx
60a อมx หม่x
61b ちカヨは
62c x ¬€x
63d 天使x
64e ü’…™¸y
65f ü’Š¯z
66g a啷bb
Bram Moolenaar745c6eb2013-09-19 17:04:30 +020067j 0123❤x
68k combinations
Bram Moolenaar96c664a2015-12-31 16:21:52 +010069l äö üᾱ̆́