cara memeriksa apakah string 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');
}
Pleasant Pintail