Before you begin: Join our book community on Discord
Give your feedback straight to the author himself and chat to other early readers on our Discord server.
Regular expressions (regex) are used to perform pattern matching against text. For the uninitiated, anything but a trivial regular expression can be a confusing mess. To make the topic more difficult, regular expressions differ slightly across different programming languages, platforms, and tools. Given that PowerShell is built on .NET, PowerShell uses .NET-style regular expressions. Regular expressions can be complex and there is often more than one way to achieve a goal, variation in expressions developed by different people is common.This chapter covers the following topics:
- Regex basics
- Anchors
- Quantifiers
- Character classes
- Alternation
- Grouping
- Look-ahead and look-behind
- The .NET Regex type
- Regex options
- Examples of regular expressions
Regular expressions can be complex, but knowing a small set of...