Regex for JSON Web Token
/\beyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*/g
Matches
Examples
Note
A JWT’s header and payload are Base64url JSON, which always starts with eyJ. Paste one into the JWT Decoder to read it.
Matches in the example
"eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIn0.c2lnbmF0dXJl"
Token by token
\ba word boundaryeyJthe text “eyJ”[A-Za-z0-9_-]+one of: “A” to “Z”, “a” to “z”, “0” to “9”, “_” or “-”, one or more times, as many as possible\.the character “.”eyJthe text “eyJ”[A-Za-z0-9_-]+one of: “A” to “Z”, “a” to “z”, “0” to “9”, “_” or “-”, one or more times, as many as possible\.the character “.”[A-Za-z0-9_-]*one of: “A” to “Z”, “a” to “z”, “0” to “9”, “_” or “-”, zero or more times, as many as possible
Other patterns
- Email address
- URL
- IPv4 address
- UUID
- Hex color
- Date (YYYY-MM-DD)
- Time (24-hour)
- US phone number
- Phone number (E.164)
- US ZIP code
- Credit card number
- URL slug
- Username
- Strong password
- HTML tag
- Semantic version
- MAC address
- JSON Web Token
- Hashtag
- @mention
- Number
- Leading and trailing whitespace
- Repeated word
- Blank lines
- Markdown link
- Quoted string
- Domain name
- File extension
- Base64
- Trailing comma