(?=.*\d) shows that the string should contain atleast one integer.
(?=.*([a-z]|[A-Z])) shows that the string should contain atleast one alphabet either from downcase or upcase.
([\x20-\x7E]) shows that string can have special characters of ascii values 20 to 7E.
{8,} shows that string should be minimum of 8 characters long. While you have not mentioned it should be at least 8 characters long but it is good to have.
1 回答
您可以使用以下RegEx模式
让我们来看看它在做什么:
如果你不确定ASCII值,你可以谷歌它或你可以使用以下代码:
正如评论中所建议的,更好的方法是:
这里:
P.S:我还没有测试过 . 如果需要,我可以稍后进行测试和更新 .