Unlike some implementations of regular expression engines, Vim's doesn't seem to support that notation ([\s\w]
) in collections. One can use POSIX character class expressions, though.
[:blank:]
is the same as \s
.
[:space:]
matches a greater number of whitespace characters than \s
does, and seems to be equivalent to \_s
.
[:alnum:]
approximates \w
, but does not match the underscore (_
).
So the collection you wanted could be written as [[:blank:][:alnum:]_]
or [[:space:][:alnum:]_]
.
I haven't verified this by testing, but it is documented in :h regexp
, :h /character-classes
, and :h /collection
.
Portability note: In other regex engines, \s
is typically the same as [:space:]
(or \_s
) is in Vim.
[[:space:][:alnum:]_]
can be used to approximate the collection of\s
and\w
, though.