1. 首页
  2. 数据库
  3. 其它
  4. Powershell小技巧之判断是否包涵大小写

Powershell小技巧之判断是否包涵大小写

上传者: 2021-02-01 12:01:29上传 PDF文件 38KB 热度 8次
使用正则表达式可以检查一个字符中是否包涵一个大写字母: $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
下载地址
用户评论