Appendices
The following appendices provide a core reference for some of the detailed areas of PowerShell – and of the broad technologies that PowerShell lets you interact with.
Regular Expression Reference
Regular expressions play an important role in most text parsing and text matching tasks. They form an important underpinning of the –match operator, the switch statement, the Select-String cmdlet, and more.
Character Classes | |
---|---|
Patterns that represent sets of characters | |
Character Class | Matches |
| Any character except for a newline. If the regular expression uses the SingleLine option, it matches any character. PS >"T" -match "." True |
| Any character in the brackets. For example: [aeiou]. PS >"Test" -match "[Tes]" True |
| Any character not in the brackets. For example: [^aeiou]. PS >"Test" -match "[^Tes]" False |
| Any character between the characters
start and end, inclusive. You may include multiple character
ranges between the brackets. For example, PS >"Test" -match "[e-t]" True |
| Any character not between any of the
character ranges start through end, inclusive. You may include
multiple character ranges between the brackets. For example,
PS >"Test" -match "[^e-t]" False |
| Any character in the Unicode group or block range specified by {character class}. PS >"+" -match "\p{Sm}" True |
| Any character not in the Unicode group or block range specified by {character class}. PS >"+" -match "\P{Sm}"False |
|
Get Windows PowerShell Quick Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.