parka Posted March 5, 2007 Share Posted March 5, 2007 This was an example from a book and it didn't work. Is there something wrong with the code or is it a php.ini thing? $username = 'parka'; $valid = ereg($username, '[[:alnum:] _-]{5,10}'); if (!$valid){ print "username is invalid"; } Link to comment https://forums.phpfreaks.com/topic/41221-validate-username-with-ereg/ Share on other sites More sharing options...
Orio Posted March 5, 2007 Share Posted March 5, 2007 I'd rather use: $valid = eregi($username, '[a-z0-9_\-]{5,10}'); Orio. Link to comment https://forums.phpfreaks.com/topic/41221-validate-username-with-ereg/#findComment-199710 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.