add "g" option for replace