[英]What patterns does PowerShell -like operator support?
I was not able to find any reference about syntax of the PowerShell -like
operator. 我无法找到有关
-like
PowerShell运算符语法的任何参考。
Windows PowerShell reference on comparison operators states only: 仅对比较运算符的 Windows PowerShell参考说明:
-Like
-喜欢
Description: Match using the wildcard character (*).描述:使用通配符(*)进行匹配。
Though by experimenting I've found that it also supports the ?
虽然通过实验我发现它也支持
?
and the []
(set). 和
[]
(设置)。
Is there any other syntax supported? 是否支持其他语法? Is there any definitive reference to the
-like
operator? 是否对
-like
运算符有明确的引用?
The help for about_Comparison_Operators indeed claims wildcard support. about_Comparison_Operators的帮助确实声称支持通配符。 It fails to specify what, exactly, a wildcard is.
它无法确定通配符的确切含义。
-Like Description: Match using the wildcard character (*).
-Like描述:使用通配符(*)进行匹配。
Further digging into help about_Wildcards we learn that these aren't your grandpa's wildcards: 进一步挖掘帮助about_Wildcards,我们了解到这些不是你爷爷的通配符:
Windows PowerShell supports the following wildcard characters. Wildcard Description Example Match No match -------- ------------------ -------- ----------------- -------- * Matches zero or a* A, ag, Apple banana more characters ? Matches exactly ?n an, in, on ran one character in the specified position [ ] Matches a range [al]ook book, cook, look took of characters [ ] Matches specified [bc]ook book, cook hook characters
The link to wildcard help is mentioned on the See also -section in about_Comparision_Operators help. 有关通配符帮助的链接,请参阅about_Comparision_Operators帮助中的另请参阅部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.