| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Seasoned Poster
Joined in Dec 2003
Hosted on Mango
85 posts
Gave thanks: 0
Thanked 0 times
|
eregi problem
Hi, I want to check a username on its input.
It may only contain numbers or a-z and the chars _ and - My code for this is if( !eregi("[a-zA-Z0-9_-]*", $username){ //print error } But this line of code always returns 1 If I enter the username fred (which is allowed) or if I enter fred+derb All is allowed Does anyone canhelp me on this one, cause I can't find the problem in here :s
__________________
SH57 server - zwammers.com Pass16 server - bloodseaker.be |
|
|
|
|
|
#2 (permalink) | |
|
Third Plateau
Comfy Contributor
Joined in Apr 2004
Lives in East Hanover, New Jersey
Hosted on Nifty
272 posts
Gave thanks: 0
Thanked 0 times
|
Quote:
^[a-zA-Z0-9_-]+$ The + makes it match once or more, and the ^ sets the beginning of the line and the $ sets the end.
__________________
site (syberdave.net) - server (nifty) |
|
|
|
|