Regular Expressions

Introduce the regex engine into our .NET apps.

We'll cover the following

Overview

A .NET application can use the power of regular expressions out of the box. Regular expressions are a versatile and effective way to process large texts.

Note: Regular expressions require a separate course of their own because of their complexity. This lesson only provides a brief overview.

We can use them to find substrings that match a certain condition, to check whether a string object conforms to our rules (correct phone number format, for instance), and so on. At the same time, with regex (regular expressions), we need far less code to address these types of tasks than we would with built-in methods of System.String and StringBuilder classes.

Example

Imagine we have a large text and want to find all words that contain the "or" substring. Our solution might look something like this:

Get hands-on with 1200+ tech skills courses.