Invalid entries still can be interpreted, e.g.
encode(0xAB
) => qw==
however invalid encoding qx==
still can be correctly decoded:
decode(qx==
) => 0xAB
.
If you want invalid encoding to match, use different (less strict) regex.
Replace [:alnum:]
with A-Za-z0-9
if your regex library does not support that notation.