类似于PowerShell的操作员支持哪些模式? [英] What patterns does PowerShell -like operator support?

查看:66
本文介绍了类似于PowerShell的操作员支持哪些模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到有关PowerShell -like运算符语法的任何参考.

I was not able to find any reference about syntax of the PowerShell -like operator.

比较运算符仅声明:

-像
说明:使用通配符(*)进行匹配.

-Like
Description: Match using the wildcard character (*).

尽管通过实验,我发现它也支持?[](设置).

Though by experimenting I've found that it also supports the ? and the [] (set).

还支持其他语法吗?是否有对-like运算符的明确引用?

Is there any other syntax supported? Is there any definitive reference to the -like operator?

推荐答案

about_Comparison_Operators 确实声称支持通配符.它无法确切指定通配符是什么.

The help for about_Comparison_Operators indeed claims wildcard support. It fails to specify what, exactly, a wildcard is.

-像 说明:使用通配符(*)进行匹配.

-Like Description: Match using the wildcard character (*).

进一步挖掘帮助 about_Wildcards 我们了解到,这些不是您爷爷的通配符:

Further digging into help about_Wildcards we learn that these aren't your grandpa's 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    [a-l]ook book, cook, look  took
             of characters

    [ ]      Matches specified  [bc]ook  book, cook        hook
             characters

通配符帮助的链接在about_Comparision_Operators帮助的另请参阅"部分中提到.

The link to wildcard help is mentioned on the See also -section in about_Comparision_Operators help.

这篇关于类似于PowerShell的操作员支持哪些模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆