'Is there a way to check if a discord account token is valid or not?

As the title says, I'm trying to create a script that will check if a discord account token (not a bot token) is valid or not. I've tried regex matching like this:

/^(?=\S*[a-z])(?=\S*[A-Z])(?=\S*\d)(?=\S*[^\w\s]\S{5,}$/g.test(token)

but I don't think this is the best method, and I feel like some tokens can slip through the net if I use this sort of detection method to check if they're valid.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source