Tegeting nested tags with regex

I am trying to turn LIs into DDs… I would have thought if I use a lookback /lookahead combo i could keep from unintentionally changing all the <ul><li>'s ( separating the MAIN UL first… and then having a rgex that checks for <LI>s that are NOT preceded by ULs and then change the <li> and </li> to <dd> and <dd>

this is what I THOUGHT would do it (it actually woks unless there is a nested list in the data)

		$dts=preg_replace("#(?&lt;!&lt;ul&gt;)&lt;li([^&gt;]*)&gt;(.*)&lt;/li&gt;.*(?!&lt;/ul&gt;)#sU", "\	&lt;dd$1&gt;$2&lt;/dd&gt;", $dts);

the whole code and sample data is this:

function makeDL($string){
	$seg=preg_match_all("#<!--DL-->.*(<ul[^>]*)>(.*)(</ul>.*<!--/DL-->)#sU", $string,$matches, PREG_SET_ORDER);
if ($seg>0){
		foreach ($matches as $match){
				/*echo "<pre>";var_dump($match);echo "</pre><hr>";continue;*/
			$toReplace=$match[0];
			$newString= str_replace("<ul","<dl",$match[1]).">";
			$dts=preg_replace("#<li><b([^>]*)>(.*)</b></li>#sU", "\	<dt$1>$2</dt>", $match[2]);
			$dts=preg_replace("#(?<!<ul>)<li([^>]*)>(.*)</li>.*(?!</ul>)#sU", "\	<dd$1>$2</dd>", $dts);
			$newString.=$dts."\
</dl>";
			$string= str_replace($toReplace,$newString,$string);
		}
	}
	return ($seg>0)? makeDL( $string) :$string;
}

$s="<p>lorem ipsum test</p>
<!--DL-->
<ul class='x'>
<li><b>item</b></li>
<li>item</li>
<li><b>item</b></li>
<li>item</li>
<li>item</li>
</ul>
<!--/DL-->
<p>lorem ipsum test</p>
<!--DL-->
<ul class='x'>
<li><b>item</b></li>
<li>item</li>
<li>item</li>
<li><b>item</b></li>
<li>item</li>
<li>item2</li>
<li>item2</li>
</ul>
<!--/DL-->
<p>lorem ipsum test</p>
<p>lorem ipsum test</p>
<p>lorem ipsum test</p>
echo makeDL($s);
?>

all help is appreciated

This would most likely be easier if you used the DOM functions…
http://www.php.net/manual/en/book.dom.php

what functions would I use…?

Essentially I am doing this to try to reparse DB provided code so my manipulation options seem somewhat limited