I have a site where users can pick a username. Currently, they can put in almost any characters including things such as @ ! # etc.
I know I can use a regex, and that's probably what I'm opting for.
I'll be using a negated set, which I'm assuming is the right tool here as so:
[^@!#]
So, how can I know all of the illegal characters to put in that set? I can start manually putting in the ones that are obvious such as !@#$%^&*(), but is there an easy way to do this without manually putting every single one of them in?
I know a lot of sites only allow strings that contain alphabets, numbers, dashes, or underscores. Something like that would work well for me.
Any help would be greatly appreciated.
Thanks S.O.!