<div id="main">
<div id="inside">текст</div>
<div class="class">текст</div>
</div>
$text = preg_replace("/<div\sid=\"main\"(.*?)<\/div>/ism", "", $text);
include('simple_html_dom.php');
$html = str_get_html('<html><div id="main"><div id="inside">текст</div><div class="class">текст</div></div>');
$html->find('div#main', 0)->innertext = '';
$outText = $html->save();