could replace these two with .replace(/\s*;;*/g, ";")