Regular expressions to check if a given GitHub token could be valid.
- Personal access tokens (classic)
 - Fine-grained personal access tokens
 - GitHub Actions
 - Combined together
 
Classic personal access tokens are 40 characters in length, with a prefix of ghp_:
^ghp_[a-zA-Z0-9]{36}$Fine-grained personal access tokens (currently in beta) are 93 characters in length, with a prefix of github_pat_:
^github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59}$Temporal tokens generated by GitHub Actions are 40 characters in length, with a prefix of ghs_:
^ghs_[a-zA-Z0-9]{36}$^(gh[ps]_[a-zA-Z0-9]{36}|github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59})$
Thanks, bro! Just used this in my code to validate user input. I linked back to you ofc.