Summary
In this chapter, we took a look at regular expressions and their use in PowerShell.
The Regex basics section introduced a number of heavily used characters. Anchors showing 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. Alternation was demonstrated using different sets of expressions to be evaluated.
We looked at repetition using "*", +, ?, and curly braces, and discussed the notion of greedy and lazy expressions.
Grouping was introduced as a means of limiting the scope of alternation in order to repeat larger expressions or to capture strings.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access