我想编写一个正则表达式,它根据以下内容匹配字符串:
/
前后不应有空格/
之前或之后只能有两个特殊字符(*
,:
)/
,只要没有空格,就可以将其视为单个匹配项示例输入看起来像
Artifacts path 'artifacts_tube/AtomInstall*/**' not found. // 1 match
</root> // 0 matches
Failed steps: [<DF2 [D:/Users/work/tmp/assets/dummyfailer]>] // 1 match
Options : *.* /NS /NC /NDL /COPY:DAT /NP /MT:32 /R:11 /W:30 // 0 matches
Copy Dir: D:/Users/tempdir/tmp8fo -> D:/Users/tempdir/tmpj7xj // 2 matches
我有一个简单的正则表达式,但它不符合上述所有标准
\S*\/\S*
。我的正则表达式的输出
Artifacts path 'artifacts_tube/AtomInstall*/**' not found. // 1 match
</root> // 1 match
Failed steps: [<DF2 [D:/Users/work/tmp/assets/dummyfailer]>] // 1 match
Options : *.* /NS /NC /NDL /COPY:DAT /NP /MT:32 /R:11 /W:30 // 8 matches
Copy Dir: D:/Users/tempdir/tmp8fo -> D:/Users/tempdir/tmpj7xj // 2 matches
这个正则表达式应该可以满足您的需要
https://regex101.com/r/nI18g9/1
这并不完全是你所要求的(它允许
:
和*
在路径的任何地方发生),但我认为你可以用它实现你的目标Regex 101 Demo
相关问题 更多 >
编程相关推荐