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