Summary
This chapter looked at regular expressions and their use in PowerShell.
The Regex basics section introduced several heavily used characters. We used anchors to show how the start and end of a string or word boundary may be used to restrict the scope of an expression.
Character classes were introduced as a powerful form of alternation, providing a range of options for matching a single character. We demonstrated alternation using different sets of expressions.
We looked at repetition using "*"
, +
, ?
, and curly braces ({}
) and discussed the notion of greedy and lazy expressions.
Grouping was used as a means of limiting the scope of alternation to repeat larger expressions or to capture strings.
Finally, we went through several examples, bringing together the areas covered in this chapter to solve specific problems.
In Chapter 10, Files, Folders, and the Registry, we will discuss working with files, folders, and the registry.
...