- PowerShell 教程
- PowerShell - 主頁
- PowerShell - 概述
- PowerShell - 環境設定
- PowerShell - Cmdlet
- PowerShell - 檔案和資料夾
- PowerShell - 日期和計時器
- PowerShell - 檔案 I/O
- PowerShell - 高階 Cmdlet
- PowerShell - 指令碼編寫
- PowerShell - 特殊變數
- PowerShell - 運算子
- PowerShell - 迴圈
- PowerShell - 條件
- PowerShell - 陣列
- PowerShell - 雜湊表
- PowerShell - 正則表示式
- PowerShell - 反引號
- PowerShell - 括號
- PowerShell - 別名
- PowerShell 有用資源
- PowerShell - 快速指南
- PowerShell - 有用資源
- PowerShell - 討論
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。
powershell_regex.htm
廣告