title: What is a regular expression for removing spaces between uppercase letters, but keeps spaces between words?
body: <p>For example, if I have a string like "Hello I B M", how do I detect the space between the uppercase letters but not between the "o" and the "I"?</p>
  
  <p>Basically "Hello I B M" should resolve to "Hello IBM"</p>
  
  <p>So far, I have this:</p>
  
  <pre><code>value = "Hello I B M"
  value = value.replace(/([A-Z])\s([A-Z])/g, '$1$2')
  </code></pre>
  
  <p>But it only replaces the first instance of a space between two uppercase letters like: "Hello IB M"</p>
  
  <p>--EDIT--</p>
  
  <p>Solution Part 1:</p>
  
  <pre><code> value = value.replace(/([A-Z])\s(?=[A-Z])/g, '$1')
  </code></pre>
  
  <p>Thanks to Renato for the first part of the solution! Just found out if there is a capitalized word AFTER an uppercase letter, it swallows that space as well. How do we preserver the space there?</p>
  
  <p>So "Hello I B M Dude" becomes "Hello IBMDude" instead of "Hello IBM Dude"</p>