improve regex

This commit is contained in:
AMelonInsideLemon 2025-08-30 04:04:27 +02:00
parent 72219ab7d5
commit 759b80698a

View File

@ -2018,7 +2018,8 @@ function doAcquireMiscItems() {
function addItemByItemType() {
const ItemType = document.getElementById("typeName-type").value;
if (!ItemType || !/^[A-Za-z/]+$/.test(ItemType) || !ItemType.startsWith("/Lotus/")) {
// Must start with "/Lotus/", contain only AZ letters, no "//", and not end with "/"
if (!ItemType || !/^\/Lotus\/(?:[A-Za-z]+(?:\/[A-Za-z]+)*)$/.test(ItemType)) {
$("#typeName-type").addClass("is-invalid").focus();
return;
}