はい、HTMLパーサーを使用し、正規表現を使用してHTMLを解析することは避けてください。
// Load the HTML into the parser
$doc = new DOMDocument;
$doc->loadHTML( '<var title="some text">Something</var>');
// Find the <var> tags, and create new <abbr> tags from them.
foreach( $doc->getElementsByTagName( 'var') as $var) {
$abbr = $doc->createElement( 'abbr', $var->textContent);
$abbr->setAttribute( 'title', $var->getAttribute( 'title'));
echo $doc->saveHTML( $abbr); // Here is your new <abbr> tag
}
このデモから、次のことがわかります。
<abbr title="some text">Something</abbr>