how to check a string valid or not code example
Example: how to check if string is valid jwt
function validateResourceName(string) {
var pattern = /(\w)*\\(?!\\)(\w)*\\(?!\\)(\w)*(?!\\)/g;
if (!pattern.test(string)) {
alert("not a match");
} else {
alert("match");
}
}
if(JWS_REGEX.test('abc')){
console.log('valid token')
} else {
console.log('not valid');
}