[vim/vim] :%s/[\n\r]//gn outputs an incorrect(?) number of matches (#2551)

14 views
Skip to first unread message

lkintact

unread,
Jan 14, 2018, 11:00:12 PM1/14/18
to vim/vim, Subscribed

Open a file with these contents (byte values shown in hex), 31 0A 31 0D 31 0A 0D 31 0D 0A 31 0A, make sure 'fileformat' is set to 'unix'.

:%s/[\n]//gn outputs '4 matches on 4 lines' as expected - there are 4 <EOL>s (<NL>s).
:%s/[\r]//gn outputs '3 matches on 2 lines', also as expected - there are 3 <CR>s.

:%s/[\n\r]//gn, however, outputs '6 matches on 4 lines', and not "7 ( = 4+3) matches ...", as one'd expect.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Reply all
Reply to author
Forward
0 new messages