- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Regular Expression - Match Quantifiers
Following is the example of supported quantifiers in 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}"
Output of all the above commands is True.
powershell_regex.htm
Advertisements