title: Remove Word smart quotes from a text file using vim
body: <p>I have a large text file, originally generated in Microsoft Word, that contains these four character sequences, alongside regular text:</p>
  
  <pre><code>?~@~\
  ?~@~]
  ?~@~X
  ?~@~Y
  </code></pre>
  
  <p>From the content of what is written in the file, it appears that the sequences respectively correspond to open double quotes, close double quotes, open single quote, and close single quote. When displayed in Vim, everything in the sequences other than the question mark appears in blue.</p>
  
  <p>I <i>cannot</i> remove them with a command such as</p>
  
  <pre><code>:.,$s/?~@~Y//
  </code></pre>
  
  <p>This command results in the following error from vim:</p>
  
  <pre><code>E33: No previous substitute regular expression
  E476: Invalid command
  Press ENTER or type command to continue
  </code></pre>
  
  <p>These commands also produce errors:</p>
  
  <pre><code>:.,$s/\?~@~Y//
  :.,$s/\?\~\@\~Y//
  </code></pre>
  
  <p>Specifically,</p>
  
  <pre><code>E866: (NFA regexp) Misplaced ?
  E476: Invalid command
  Press ENTER or type command to continue
  </code></pre>
  
  <p>What would be the correct way to automatically remove or replace the sequences? Ideally, I'd like to remove the double quotes, and replace the open/close single quotes with a traditional single quote or apostrophe.</p>