%s /_find_/_replace_/gc
(case-insensitive and ask for each instance)
All regexp chars need to be escaped \^
, \(
, \)
etc
\0 full match, \1 first group, \2 second etc..
%s /^\(\s\+\)\([^:]\+\):/\1"\2":/gc
- begining of line find all spaces followed by string followed by colon, replace with space + " + string +":
%s /,\(\_s\+\)]/\1}/gc
- find all commas at end of line that are followed by whitespace and closing }|]
IE to make a js object valid json