### Godot version

4.1.dev (1becfea37c)

### System information

MacOS 13.3 M1 Pro

### Issue description

When renaming with Batch Rename using invalid character `NodePath` will be updated with the invalid new name.

### Steps to reproduce

1.  open MRP
2. batch rename all nodes except the root from `e` to `%`
3. look at the `NodePath` on the root

### Minimal reproduction project

[test1.zip](https://github.com/godotengine/godot/files/11377324/test1.zip)

#include "rename_dialog.h"
#include "modules/modules_enabled.gen.h" 
#ifdef MODULE_REGEX_ENABLED
#include "core/string/print_string.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/editor_themes.h"
#include "editor/editor_undo_redo_manager.h"
#include "modules/regex/regex.h"
#include "plugins/script_editor_plugin.h"
#include "scene/gui/check_box.h"
#include "scene/gui/check_button.h"
#include "scene/gui/control.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/label.h"
#include "scene/gui/option_button.h"
#include "scene/gui/separator.h"
#include "scene/gui/spin_box.h"
#include "scene/gui/tab_container.h"
RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
	scene_tree_editor = p_scene_tree_editor;
	preview_node = nullptr;
	set_title(TTR("Batch Rename"));
	VBoxContainer *vbc = memnew(VBoxContainer);