php - ereg to preg conversion -


When it comes to regex, I am a full newbie. Does anyone have to help me convert the following expression into a pregender?

  Erag ('[a-zA-Z0-9] + [[: punct:]] +', $ password)  

Any solution With an explanation would be particularly useful!

To answer your actual question, you need to have your code structured like this:

  if (preg_match ('/ [az] + /', $ password] & amp; amp; amp; preg_match ('/ [AG] + /', $ password] & amp; amp; ; And; preg_match ('/ [0-9] + /', $ password) and amp; preg_match ('/ [[: punct:]] + /', $ Password) ...  

If you want to ensure the presence of at least one lowercase letter, at least one uppercase letter, at least one digit, and at least one punctuation mark


  • Comments