vim - Search and replace apostrophes using regex in VI -


i trying search , replace occurrences of backslashes followed single quote 1 backslash , quote. this:

everyone\\\\\\\\\\\\\\\'s everyone\'s in vi.

it should replace: blah\\\\\\\'\' blah\'\'

i unable fiqure out how it.

tried : :%s/\\\+\'/\\'/ works first one.

i tried: :%s/\\\+?\'/\\'/ dont work.

what should correct regex it?.

this worked requirement:

replace occurrences of backslashes followed single quote one backslash , quote.

 %s/\\\+'/\\'/g 

your 2 examples:

everyone\\\\\\\\\\\\\\\'s -> everyone\'s blah\\\\\\\'\' -> blah\'\' 

tested vim 7.3


Comments