How to check if string has at least one letter, number and special character in php

后端 未结 6 1494
傲寒
傲寒 2020-12-24 09:23

I am currently writing a small script that checks the contents of each string.

I was wondering what the REGEX would be to make sure that a string has a letter (upper

6条回答
  •  醉酒成梦
    2020-12-24 10:07

    A letter is \pL, a number is \pN and a special char is [what you want], here I assume it is not a letter and not a number, so the regex looks like:

    /^(?=.*?\pL)(?=.*?\pN)(?=.*[^\pL\pN])/
    

提交回复
热议问题