modifying function escapeHTML using regular expression