I'm facing a problem where I haven't seen proper answer anywhere. What I need help with is this:
How can I prevent my users registering non-alphanumeric usernames? To be exact, I could prevent it by using something like:
function validate_alphanumeric_underscore($string?) { return preg_match('/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/',$str); }
But what is the string I should/could use and how can I echo error message saying that the username inputted had invalid characters?
Cheers!