title: jQuery Regex to extract all HTML except br, bold, italic, and a
body: <p>I'm using an extremely ugly function in jQuery to listen on a <code>paste</code> event and remove all extraneous HTML formatting from the paste. Unfortunately, what I have now is overly strict, on top of just being butt-ugly.</p>
  
  <p>I want to improve this regex to allow for the same HTML I'm already allowing inside the WYSIWYG editor. This means I would like to have <code>&lt;b&gt;</code>, <code>&lt;i&gt;</code>, <code>&lt;br&gt;</code>, and <code>&lt;a&gt;</code> tags allowed.</p>
  
  <p>I do not know enough regex to do this myself, and would be very appreciative to see this improved.</p>
  
  <pre><code>$('iframe').ready(function() {
    $(this).contents().find('.wysiwyg').find('iframe').contents()
    .find('.wysiwyg').bind('paste', function() {
      var el = $(this);
      setTimeout(function() {
          var strClean = el.text().replace(/&lt;\/?[^&gt;]+&gt;/gi, '');
          el.text(strClean);
      }, 0);
    });
  });
  </code></pre>
  
  <p>You can see this ugly code at work here: <a href="http://jsfiddle.net/v4LhV/3/" rel="nofollow">http://jsfiddle.net/v4LhV/3/</a></p>