Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcnaveen/998ee6509257f849efb8489d264fe859 to your computer and use it in GitHub Desktop.
Save mcnaveen/998ee6509257f849efb8489d264fe859 to your computer and use it in GitHub Desktop.

Example Text:

Hello,"Hello | World"
Hello | How are you?,

I want to replace the pipe | which is present inside the double quotes with comma ,

Here is the command to do that.

:%s/"[^"]*"/\=(substitute(submatch(0), '|', ',', 'g'))/g

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment