[PHP] Problem with regex
Hi, I need a regex for a username validation. The ereg function should be used. o the username must start and end with a-z o in the middle it could be a-z0-9\.-_ o and never something like this -- -. _- and so on Thanks for your help Oliver = mailto: [EMAIL PROTECTED] www.ertl.co.za __ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problem with regex
Hi, The following works. But I wouldn't allow users to use something like -. --- _- in $TestPwd. How can I implement this ? --- Steve Edberg <[EMAIL PROTECTED]> wrote: > if (ereg('^[a-z][-a-z0-9\._]*[a-z]$', $TestPwd)) { > echo "Good"; > } else { > echo "Bad password $TestPwd"; > } = mailto: [EMAIL PROTECTED] www.ertl.co.za __ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]