fixed regex preventing user from entering a sector with a space in the name in interactive mode

This commit is contained in:
TanguyPcFixe 2024-05-26 21:46:18 +02:00
parent 8794b22212
commit 479854809d

View File

@ -8,16 +8,16 @@ import sys
#IMPORTANT BITS #IMPORTANT BITS
###This is the name of the sector you want to search into (Do not use caps!) ###This is the name of the sector you want to search into (Do not use caps!)
sectorName = "Byoomiae" sectorName = "Phoi Auwsy"
### "weights" to query, beware of big results when searching for lighter systems in more dense area ### "weights" to query, beware of big results when searching for lighter systems in more dense area
weightsToQuery = ["a","b","c","d","e"] weightsToQuery = ["f","g","h"]
### postFix List, modify as needed ### postFix List, modify as needed
#postFixList =["AA-A","BA-A","CL-Y","DL-Y","EG-Y","FG-Y","YE-A","ZE-A"] postFixList =["AA-A","BA-A","CL-Y","DL-Y","EG-Y","FG-Y","YE-A","ZE-A"]
postFixList =["WP-X"] #postFixList =["WP-X"]
@ -65,7 +65,7 @@ if (len(sys.argv) > 1):
if arg == "-i": if arg == "-i":
print("Starting interactive mode.") print("Starting interactive mode.")
print("Please input a sector name with only the first letter capitalized (ex : Byoomiae) ") print("Please input a sector name with only the first letter capitalized (ex : Byoomiae) ")
sectorNamePattern = re.compile("^[A-Z][a-z]+$") sectorNamePattern = re.compile("^[A-Z][a-z]+ *[A-Z]*[a-z]*$")
possibleSectorName = input() possibleSectorName = input()
while not sectorNamePattern.match(possibleSectorName): while not sectorNamePattern.match(possibleSectorName):
print("The sector name you have entered is incorrect. Please try again") print("The sector name you have entered is incorrect. Please try again")