I have been going through some answers to a vimgolf, and stumbled upon this regex:
:s/\_W*/-/g|x<CR>
Which converts
abcdefghijklm
to
-a-b-c-d-e-f-g-h-i-j-k-l-m-
The regex (without unrelated keystrokes) is /\_W*/-/
. The manual indicates that:
\W
stands for non-word character: [^0-9A-Za-z_]
\_x Where "x" is any of the characters above: The character class with
end-of-line added
So \_W
is non-word characters with end-of-line added.
How does that put the dashes between the characters? Is there a hidden metacharacter between each character in vim text?