不乱于心,不困于情。
不畏将来,不念过往。如此,安好。

Powershell-正则表达式-匹配量词

以下是Windows PowerShell中受支持的量词的示例

#Format:  *
#Logic    Specifies zero or more matches; for example, \wor (abc). Equivalent
#         to {0,}.
 "abc" -match "\w*"

#Format:  +
#Logic:   Matches repeating instances of the preceding characters.
 "xyxyxy" -match "xy+"

#Format:  ?
#Logic:   Specifies zero or one matches; for example, \w? or (abc)?.
#         Equivalent to {0,1}.
 "abc" -match "\w?"

#Format:  {n}
#Logic:   Specifies exactly n matches; for example, (pizza){2}.
 "abc" -match "\w{2}"

#Format:  {n,}
#Logic:   Specifies at least n matches; for example, (abc){2,}.
 "abc" -match "\w{2,}"

#Format:  {n,m}
#Logic:   Specifies at least n, but no more than m, matches.
 "abc" -match "\w{2,3}"

以上所有命令的输出为True。

赞(1)
未经允许不得转载:seo优化_前端开发_渗透技术 » Powershell-正则表达式-匹配量词