O'Reilly logo

C# 7 and .NET Core Cookbook by Dirk Strauss

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

Let's take a closer look at the two expressions used in the previous code example. Comparing them with each other, you can see the change we made in yellow:

Before we get to what that change means, let's break up the expression and view the individual components. Our regex is basically saying that we must match all string dates that start with 19 or 20 and have the following separators:

  • Dash (-)
  • Decimal (.)
  • Forward slash (/)

To understand the expression better, we need to understand the following format of the expression <Valid Years><Valid Separators><Valid Months><Valid Separators><Valid Days>.

We also need to be able to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required