- 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 value #Matches exact characters anywhere in the original value. "book" -match "oo" #Format . #Logic Matches any single character. "copy" -match "c..y" #Format [value] #Logic Matches at least one of the characters in the brackets. "big" -match "b[iou]g" #Format [range] #Logic Matches at least one of the characters within the range. The use # of a hyphen (-) allows you to specify an adjacent character. "and" -match "[a-e]nd" #Format [^] #Logic Matches any characters except those in brackets. "and" -match "[^brt]nd" #Format ^ #Logic Matches the beginning characters. "book" -match "^bo" #Format $ #Logic Matches the end characters. "book" -match "ok$" #Format * #Logic Matches any instances of the preceding character. "baggy" -match "g*" #Format ? #Logic Matches zero or one instance of the preceding character. "baggy" -match "g?"
以上所有命令的輸出為 True。
powershell_regex.htm
廣告