title: body tag class ReGex
body: <p>This is an odd request. I am using jQuery get to AJAX request some full page html content. Once I have the content captured in an object var, I want to grab the body tag class of the captured content and  replace the current DOM body class with it.</p>
  
  <p>Since the content is in a var and not loaded in to the DOM jQuery is useless against it. The best tool I can think of is Regex.</p>
  
  <p>I have looked for hours on the internet and found nothing.</p>
  
  <p>Here is the best code I could come up with but it doesn't work...</p>
  
  <pre><code>var data = '&lt;html class="please_god_no" id="shit"&gt;&lt;body id="id_no" class="test22"&gt;test2 class="test1" "test3"&lt;div id="bad" class="test5 test6"&gt;test4&lt;/div&gt; &lt;/body&gt;&lt;/html&gt;'; 
  var arr = data.match(/&lt;body class=("[\w\d]*")\sid=("[\w\d]*")&gt;([\w\d]*)&lt;/body&gt;/);
  alert(arr);
  </code></pre>
  
  <p>I just want the class I don't need or want any other attributes. Any help on how to find the answer would be most helpful.</p>