VIM search and replace regex

pcre, regex, vim

Solution

I believe just `:s/,/,1/` should do it. If you don't use the `g` option, it will only replace the first instance found per line.

Do `:%s/,/,1/` if you want it to apply to the entire file, the first option only does it for a single line.

Problem

What's the best way in VIM using search and replace to add the number 1 after every FIRST comma on a line? Each line has multiple commas (this is a csv), I want to insert the value 1 though after the first comma on each line.

Original source