Better B64 regex, shoutout to ~ASM

py3
panki27 7 years ago
parent 8bfd7b2468
commit 4fda56d33b

@ -61,7 +61,7 @@ def translate(inputString, inputType, outputType):
result = chr(inputString) result = chr(inputString)
return result return result
def base64prompt(): def base64prompt():
b64regex = '\S*=$' b64regex = '^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$'
inputString = raw_input('Please input your string: ') inputString = raw_input('Please input your string: ')
match = re.match(b64regex, inputString) match = re.match(b64regex, inputString)
if (match): if (match):

Loading…
Cancel
Save