This is the latest version of my script to replace html tag formatting with character styles, as inspired by Dave Saunders.
// Tag to CharStyles, by Dirk Becker
var myDoc = app.documents[0];
var myStory = app.documents[0].stories[0];
myStory.contents = myDoc.stories[1].contents;
var myRE = new RegExp("</?(i|b|sup|sub|em|strong)>","i");
var paraCnt = myStory.paragraphs.length;
for( var paraInx=0; paraInx<paraCnt; paraInx++ ) {
	var myText = myStory.paragraphs[paraInx];
	var prevIndex = null;
	var prevStyle = null;
	//	variable names have to match tag names
	var b = false,i = false,em = false,strong = false,sub = 0,sup = 0;
	// look for all start and end tags
	var matched = myRE.exec(myText.contents);
	while( matched!=null ) {
		var tagName = matched[1].toLowerCase();
		var tag = matched[0];
		var isStartTag = matched[0].charAt(1)!="/";
		switch( tagName ) {
		case "sub": isStartTag ? sub++ : sub--;	break;
		case "sup": isStartTag ? sup++ : sup--;	break;
		default: eval(tagName+"=isStartTag"); // flags
		}
		var index = matched.index;
		var style;
		var styleName = ( b ? "Bold" : "" )
				+ ( i ? "Italic" : "" )
				+ ( em ? "Emphasized" : "" )
				+ ( strong ? "Strong" : "" )
				+ ( sub ? "Sub" + sub : "" )
				+ ( sup ? "Sup" + sup : "" );
		if( styleName=="" ) {
			style = null;
		} else try {
			style = myDoc.characterStyles.item(styleName);
			style.name;
		} catch( ex ) {
		//	alert(styleName);
			style = myDoc.characterStyles.add();
			style.name = styleName;
		}
		// strip the tag
		myText.characters.itemByRange(index,index+tag.length-1).contents = "";
		if( prevStyle!=null )
			myText.characters.itemByRange(prevIndex,index-1).appliedCharacterStyle = prevStyle;
		prevStyle = style;
		prevIndex = index;
		matched = myRE.exec(myText.contents);
	}
	if( prevStyle!=null )
		myText.characters.itemByRange(prevIndex,-1).appliedCharacterStyle = prevStyle;
}