相关疑难解决方法(0)

正则表达式匹配任何顺序包含两个名称的字符串

我需要正则表达式中的逻辑AND.

就像是

杰克和詹姆斯

同意以下字符串

  • '你好杰克在这里是詹姆斯 '

  • "你好詹姆斯在这里是杰克 "

regex string

149
推荐指数
9
解决办法
16万
查看次数

在PowerShell中检查路径是否存在的更好方法

我只是不喜欢以下语法:

if (Test-Path $path) { ... }
Run Code Online (Sandbox Code Playgroud)

if (-not (Test-Path $path)) { ... }
if (!(Test-Path $path)) { ... }
Run Code Online (Sandbox Code Playgroud)

特别是在检查"不存在"这种常见用途时,括号太多且不易读.有什么更好的方法呢?

更新:我目前的解决方案是使用别名exist,并not-exist为解释在这里.

PowerShell存储库中的相关问题:https://github.com/PowerShell/PowerShell/issues/1970

powershell

100
推荐指数
4
解决办法
29万
查看次数

标签 统计

powershell ×1

regex ×1

string ×1