I am trying to write a regular expression in vi to match any whitespace character followed by any digit. Then, at each match, insert a dollar sign between the whitespace and the digit. Here is an example:
A1234 12 14 B1234
B1256 A2 14 C1245
C1234 34 D1 1234K
The correct regex would produce this:
A1234 $12 $14 B1234
B1256 A2 14 C1245
C1234 $34 D1 $1234K
I realize I need to use a back reference, but I can't quite seem to write the correct regex. Here is my attempt:
:'<,'>/(\s\d)/\s\1\$/g
Also, I have Vim's default regex mode turned off (vnoremap / /\v).
Thanks for the help.
14in the second line of the correct result example is not prepended with$?