Nandini Posted May 20, 2010 Share Posted May 20, 2010 Hi I want to check atleast one number and one letter in php string using regular expressions. I am using the followinf snippet. But thats not working me fine. Please help me. here is my code $reg="/^[a-z0-9]{1,}$/"; if(preg_match($reg, $_POST['string'])) { $e="String should be atleast one letter and one number"; } pls help me out. Thanq Quote Link to comment Share on other sites More sharing options...
Nandini Posted May 20, 2010 Author Share Posted May 20, 2010 Ya i got a solution like this $reg="/^.*(?=.{6,})(?=.*\\d)(?=.*[a-zA-Z]).*$/"; This will check minimum of 6 length and atleast one letter and one number Thanq Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.