Created
November 4, 2021 08:33
-
-
Save byurhannurula/a76d8ef2e2d25c5e0f9d30d945c8e32a to your computer and use it in GitHub Desktop.
Check string if it's a JWT token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const JWT_PATTERN = "(^[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*\$)"; | |
function isJWT(data) { | |
return new RegExp(JWT_PATTERN).matches(data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment