title: Regular Expression: replace everything but not a specific word
body: <p>I'm trying to perform a simple <code>replace();</code> method in <code>JavaScript</code> where I'd like to remove every class from an <code>HTML element</code> except a specific one, how can I do it?</p>
  
  <p>I tried this without success:</p>
  
  <pre><code>&lt;div id="my_div" class="hello letsgo baby is_checked cool"&gt;Gordon Freeman&lt;/div&gt;
  
  &lt;script&gt;
  $(document).ready(function () {
      alert ($(#my_div).attr("class").replace (/^(is_checked)$/, ""));
      // id'like it returns "is_checked" or "" to work like a boolean;
  });
  &lt;/script&gt;
  </code></pre>