Hello, I want to create a regular expression that allows users to only enter letters, numbers, underscores and dashes in their username. I used the ereg function like this:
if (!ereg("[a-zA-Z0-9_\-]", "$_POST[username]")
This however only returns false if all the characters entered are illegal characters. What did I do wrong, and what should it be?
Thank you for your time.