Regular expressions (regex) are used to perform advanced searches against a 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. There are often several different ways to achieve a goal when using regular expressions.
In this chapter, we'll cover the following topics:
- Regex basics
- Anchors
- Repetition
- Character classes
- Alternation
- Grouping
- Examples