Fixing html escaping when pattern filled