
Introduction and Course Structure Overview.
Explore single character patterns and basics of regular expressions in C# .NET. Learn to use inline options for case-insensitive matching, and build sets, ranges, and escapes for hex and Unicode.
Explore greedy and lazy quantifiers, backtracking, and end-of-sentence digit capture in regex with c# while matching apple pastry, apple paste, or apple pie case-insensitively.
Explore how groups segment patterns into sub patterns, enabling optional and repeating parts, named and non-capturing groups, back references, and replacements to capture or reformat text.
Explore look behind in regex, using positive and negative look behind with preconditions to match text, illustrated by extracting four-letter product codes and filtering prices not ending in .99.
Learn to fix regex performance degradation by removing outer group repetition, using non-capturing groups, and adding precise word boundaries, with emphasis on unit testing positive and negative cases.
Explore static, instance, and compiled directive in dotnet regex to balance performance, timeout handling, and caching of patterns and opcodes.
Compare static and instance regex performance in .net by testing timeouts and 10,000 invocations, and evaluate compiled patterns versus interpreted ones, highlighting cache size effects and reuse benefits.
Define regex patterns in C# .NET using regular and literal strings, learn to escape backslashes, and understand when to read patterns from input versus hardcode them.
Learn to obtain rich match details with IsMatch, the match and next match methods, the matches collection, and groups—named year, month, day, plus group indices.
Explore regex find-replace and split in C# .NET, using named groups and dollar syntax for date reformatting, custom match evaluators, and pattern-based text splitting and joining.
Learn to write log parser regex patterns for robocopy logs in C# .NET, capturing source and destination paths with named groups, and handling errors, timestamps, and multi-line logs.
Convert unstructured robocopy logs to json using regex patterns and named groups, building a json structure with directory objects, a matrix header, and arrays for directory, file, and bytes transferred.
Use regular expressions to parse sensor data from a data center, extracting date headers and temperature-humidity pairs. Create two patterns for date and for the temperature-humidity data.
Parse sensor data into a json structure by extracting the date value, temperature arrays, and humidity arrays with compiled, case-insensitive regex patterns, enabling fast, scalable processing of multi-day datasets.
Write and test a regex solution to clean HTML table data, collapse whitespace, and capture rows and columns with lazy and backreferences, handling rows with attributes.
Hi, and welcome to the Regular Expressions (Regex) with C# .NET - Easy and Fast!
Regular Expression (regex) is a pattern detection language – they are typically used to search patterns in text, extract matching values, and data validation.
Regex is supported in many programming languages, including Python, C#, JavaScript, Perl, SQL, and more.
This course is designed to provide hands-on experience with regular expressions through various exercises and projects
I am Chandra Lingam, and I am your instructor.
Here are some typical uses of regular expression
Pattern Detection
Look for occurrences of a pattern using a concise language
Data Preparation
Data clean-up and preparation is often one of the most time-consuming activities
You can define the structure of data as a regex pattern and parse data
One good application of this is AWS Glue and Athena.
You can use regex to define the structure of a record in a text file, and query the file using SQL
Input Validation
You can implement a client-side check for input validation
For example, your app can guide the user to provide data in the correct format.
As part of the zero-trust architecture, you need to validate input to your microservice
With regex, you can verify and validate data payloads in your service
Cloud Services
Several cloud services use regex for advanced configuration.
With the AWS web application firewall, you can allow or deny traffic based on a regex pattern
In Google Workspace, you can use regex for content filtering, Gmail route configuration, and to search for content in google docs
In Google Analytics, you can use regex to locate and transform matching data in your data set
Regex is also supported by several products such as SAP, Oracle, and SQL Server
Curriculum
Here is a brief course outline:
In the Regex features section, you will get familiar with various regex methods, their purpose, and how-to unit test your pattern
In the regex language section, you will learn how to write patterns – starting from the simplest of patterns
You will also learn to incorporate regex in your HTML input types for validation
Regex engine puts the onus on the developers, that is us, to write efficient patterns
You will gain knowledge of regular expression engine that will help you write optimal patterns
There are several exercises for you to apply your new skills
We then look at performance and how poorly written patterns can degrade exponentially
How to optimize the patterns and address performance issues
In .NET, there are a few different ways to interact with the regular expression class
You will gain insight into what method is appropriate for a given performance requirement
There are four hands-on projects in this course
You will learn how to apply the regex for distinctly different data sets – unstructured log data, IoT sensor data, and parsing medical test data in HTML format
You will get prompt support through the course Q&A forum and private messaging.
I am looking forward to meeting you