Powershell RegularExpression无法按预期工作

时间:2018-07-27 13:47:27

标签: regex powershell

嘿,我只是想检查一个字符串是否包含大写字符。

所以我要检查一下:

$password = "alllowercaseisnotenough"
#check if UpperCase Letter is Contained:
if($password -match '.*[A-Z].*'){
    Write-Host "+ Password has UpperCase Character[s]"
} else {
    Write-Host "- Password has no UpperCase Character[s]"
}

问题是它说“ +密码具有大写字母”,有人可以解释为什么此检查不起作用吗?

0 个答案:

没有答案
相关问题