checking a password for upper lower numbers and symbols

后端 未结 3 455
故里飘歌
故里飘歌 2020-12-16 05:32

I am using the below script to check my passwords for length, uppercase, lowercase and numbers.

How could I change it to make it check FOR symbols instead of against

3条回答
  •  轮回少年
    2020-12-16 06:21

    Either you determine a list of valid symbols:

    preg_match('`[\$\*\.,+\-=@]`',$password)
    

    or you can look for anything that isn't alnum:

    preg_match('`[^0-9a-zA-Z]`',$password)
    

提交回复
热议问题