Getting started with regex
We will be create a new class in C# called Chapter9
. Here, we will create various methods to illustrate the use of regex.
Getting ready
For the purpose of this book, we will create a simple console application to illustrate the use of regex. In reality, you would probably not have this logic mixed in with your production code, because this would result in code being rewritten. The best place to add something like regex is in a helper class within an extension method.
How to do it…
Start by right-clicking the solution, going to Add, and then to New Project from the context menu:
The Add New Project window opens up. Select the Class Library project type and call the project
Chapter9
:After the new class file has been added, your Solution Explorer should look like this:
Right-click the
Class1.cs
file and select Rename from the context menu:Rename the
Class1.cs
file toRecipes.cs
and select Yes from the confirmation dialog:In the console application, click on the References...