compile regexps just once, new function text_ent which can createTextNode with html entities (using ugly innerHTML hack, but hack, it works!)