Código PHP:
<script language="javascript">
function highlight()
{
var str = document.getElementById("CODE").innerHTML;
var pattern_keyword = /b(for|each|back|a|i)b/g;
var pattern_comment = /((.+s*)*)/g;
var pattern_string = /(".+")/g;
var pattern_number = /b(d+.?d*)b/g;
var pattern_hexnumber = /(&Hd+)/g;
str = str.replace(pattern_keyword , "<span class=\"VB_KEYWORDS\">$1</span>");
str = str.replace(pattern_comment , "<span class=\"VB_COMMENTS\">$1</span>");
str = str.replace(pattern_string , "<span class=\"VB_STRINGS\">$1</span>");
str = str.replace(pattern_number , "<span class=\"VB_NUMBERS\">$1</span>");
str = str.replace(pattern_hexnumber , "<span class=\"VB_NUMBERS\">$1</span>");
document.getElementById("CODE").innerHTML = str;
}
</script>