JavaScript regex fix