javascript replace $1 not working