I need to prepend a backslash \ to each character in a string, excluding any leading whitespace. I believed the following would do the trick.
:s/^\s*\(.\)\+/\\\1/g
but it produces this result for the string shown
abcde
\e
i.e. it shows only the last such replacement, not each of them.
Vim provides 2 regex engines, which you can access explicitly by prepending the search string with either '\%#=1' or '\%#=2'. Both produce the same result.
Could someone explain what I am doing wrong here?