Verifique se a string corresponde a regex python
# Example from https://docs.python.org/3/howto/regex.html
import re
p = re.compile('ab*')
p.match(input1)
CompSciGeek
# Example from https://docs.python.org/3/howto/regex.html
import re
p = re.compile('ab*')
p.match(input1)
import re
regExPattern = re.compile("[0-9]")
input1 = "5"
if not re.fullmatch(regExPattern, input1):
print("input is not a single digit")