Powershell小技巧之判断是否包涵大小写
使用正则表达式可以检查一个字符中是否包涵一个大写字母: $text1 = 'this is all lower-case' $text2 = 'this is NOT all lower-case' $text1 -cmatch '[A-Z]' $text2 -cmatch '[A-Z]' 结果将返回”true”或”false” 反过来检查是否包含小写,可以尝试这样: $text1 = 'this is all lower-case' $text2 = 'this is NOT all lower-case' $text1 -cmatch '^[a-z\s-]*$' $text2 -cm
下载地址
用户评论