I am trying to valuate a simple string that a user enters to make sure that it only contains letters, numbers, underscores and dashes. The current code I have is...
if (!eregi("^[a-z]{3,50}",$NewUserame)) message("Your Username does not consist of valid characters.");
Where $NewUsername is the username they entered in and Message() is a function I built myself.
If I put in something like: Josh$@$
It will pass that and say it contains valid characters when it does not. It is probably something wrong with my parameters but I am not sure. Any helps would be appreciated. Thanks.