improve regex
This commit is contained in:
		
							parent
							
								
									72219ab7d5
								
							
						
					
					
						commit
						759b80698a
					
				@ -2018,7 +2018,8 @@ function doAcquireMiscItems() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function addItemByItemType() {
 | 
					function addItemByItemType() {
 | 
				
			||||||
    const ItemType = document.getElementById("typeName-type").value;
 | 
					    const ItemType = document.getElementById("typeName-type").value;
 | 
				
			||||||
    if (!ItemType || !/^[A-Za-z/]+$/.test(ItemType) || !ItemType.startsWith("/Lotus/")) {
 | 
					    // Must start with "/Lotus/", contain only A–Z letters, no "//", and not end with "/"
 | 
				
			||||||
 | 
					    if (!ItemType || !/^\/Lotus\/(?:[A-Za-z]+(?:\/[A-Za-z]+)*)$/.test(ItemType)) {
 | 
				
			||||||
        $("#typeName-type").addClass("is-invalid").focus();
 | 
					        $("#typeName-type").addClass("is-invalid").focus();
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user