English
Topic 2. Regular expressions and text processing in C#
Goal: become familiar with .NET regular expression syntax and the classes of the System.Text.RegularExpressions namespace; learn to validate, search, extract, replace, and split text data using the Regex class, groups, lookarounds, and RegexOptions; master protection against catastrophic backtracking, the [GeneratedRegex] source generator, and unit testing of patterns.
Lecture contents
- Regular expression syntax — Regular expressions in .NET · Characters and character classes · Quantifiers, anchors, and alternation
- The Regex class and groups — The Regex class and match results · Groups and backreferences
- Replacement, options, and lookarounds — Replacing and splitting text · RegexOptions · Lookahead and lookbehind
- Performance, generation, and testing — Performance and security · The [GeneratedRegex] source generator · Input validation and unit tests for patterns
- Common mistakes — Common mistakes