powershell命令是什么知道字符串' / DSA_Global_UNIX / Library / Global / UNIX / Server正常运行时间报告/服务器正常运行时间和补丁合规性报告'包含一个字母,而不是字母a-z,A-Z,0-9,_,。, - ?
答案 0 :(得分:1)
$str -match '[^\w.-]'
$str = "/DSA_Global_UNIX/Library/Global/UNIX/Server Uptime Report/Server uptime and Patch Compliance report"
$str -match '[^\w.-]'
对于您的字符串,它会返回true
,因为它包含/
和(空格)。
只有来自集合[\w.-]
的字符的字符串将返回false,例如:
DSA_Global_UnixLibraryGlobalUNIXServerUptimeReportServeruptimeandPathCompliancereport