js replace string in g mode