I am trying to use pyinputplus to validate some inputs for storing flight arrangements.
In particular I am having issues with the allowRegexes keyword.
Here is my code (python 3.8.5):
>>> import pyinputplus as pyip
>>> confirmation_number = pyip.inputStr(
... prompt='Confirmation number = ',
... allowRegexes=[r'\w{6}']
... ).upper()
Confirmation number = #$%}|+_
>>> name = pyip.inputStr(
... prompt='Reservation name = ',
... allowRegexes=[r'([A-Za-z]+\s[A-Za-z]+)']
... ).title()
Reservation name = F1rstn@me La$tnam3
>>> confirmation_number
'#$%}|+_'
>>> name
'F1Rstn@Me La$Tnam3'
I would have expected that both of these inputs would have been blocked. Apparently, both will allow any input.
The docs only explain that allowRegexes will override blockRegexes, and any examples online I've found provide examples of regex and phone numbers, but not what is/isn't blocked accordingly.
Possible duplicate of Why is the allowRegexes keyword in pyinputplus allowing ABC in pyip.inputNum(allowRegexes=[r'(C)+'])?