mysql - How do I check if a password has at least one number in it using PHP -


i learning @ moment php & mysql please excuse me if question silly. trying create simple login/registration system based on php , mysql.

my idea check if password has number in , if doesn't give error message. problem if include number in password still gives error. if can me grateful. thank in advance.

my code is:

if(!preg_match('/^[0-9]*$/',$_post['password'])){      die('password must contain @ least 1 number.'); } 

best regards,

george stoqnov

the * means 0 or more need +

'/[0-9]+/' 

and remove ^$ because means has start , end expression


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -