diff --git a/editor.html b/editor.html
index ec47f48a..b2dc12b9 100644
--- a/editor.html
+++ b/editor.html
@@ -736,6 +736,11 @@
Telegram Limits Editor
id += `_${duplicateNumber}`;
}
+ id = id.replace(/_+$/, '');
+ id = id.replace(/^_+/, '');
+
+ id = id.replace(/_+/g, '_');
+
return id;
}