murisfurder / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

match(' ', '[^\s]') matches on whitespace #307

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

:echo match(' ', '[^\s]')

What is the expected output?

-1

What do you see instead?

0

What version of the product are you using? On what operating system?

7.4.475, Windows, from http://files.kaoriya.net/vim/

Please provide any additional information below.

Note that :echo match(' ', '[^\S]') also returns 0.

Original issue reported on code.google.com by jke...@connectwise.com on 30 Dec 2014 at 4:08

GoogleCodeExporter commented 9 years ago
Your expression is asking for the index of the first item in ' ' that
matches neither backslash nor 's'. And that index is 0.

Invalid.

Original comment by 676c7...@gmail.com on 30 Dec 2014 at 4:29

GoogleCodeExporter commented 9 years ago
I see, I need to use the [:foo:] for character classes instead. 

    echo match(' ', '[^[:blank:]]')

Thanks, sorry for the noise. 

Original comment by jke...@connectwise.com on 30 Dec 2014 at 6:00

GoogleCodeExporter commented 9 years ago

Original comment by chrisbr...@googlemail.com on 30 Dec 2014 at 8:48