var t = '<div></div>fd<p>gdfg<br>dfgdfg<br />fdgdf</p>gd'.replace(/<\/?([^>]+)>/gi, function($1, $2) { return $2.toLowerCase().indexOf('br') ? '' : $1; }); alert(t);