This does not work well for HTML, you need to parse HTML with a different tokenizer.