I'm trying to regex on the client as well as the server with this validation of a Base64 encoded 256-bit number without the =
padding.
^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]$
This is my code which isn't working as expected as any value seems to return true:
$.fn.validateKey = function() {
var re = /^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]$/
var re = new RegExp($(this).val());
return re;
};
How can I validate Base 64 encoded 256-bit signing keys without padding with javascript?