|
Posted by Eli on 09/25/78 11:10
Sorry for the spam.. here it is:
<?php
function tag_rep($tag)
{
return
preg_replace('/(?<!\<)(\S+)\s*=\s*(?<![\'"])([^\s\'"]+)(?![\'"])/','\1="\2"',$tag);
}
$html="<p class=MsoNormal id=par><font size=3 face=\"Comic Sans
MS\"><span lang=NL style='font-size:12.0pt;font-family:\"Comic Sans
MS\"'><a
href=http://www.php.net/index.php> key=value </a></span></font></p>";
$improved_html=preg_replace('/\<(.*)\>/Ue','"<".tag_rep("\1").">"',$html);
echo str_replace("\\'","'",$improved_html);
?>
:)
Navigation:
[Reply to this message]
|