Fix ConfirmSubstitutionMode so it correctly handles the 'g' flag.