Perl Training Logo: Praying Mantis
Regular Expressions for .NET programmers

Regular Expressions are invaluable to todays tasks. The obvious proof is that after many years that they were only available in a relatively small set of languages now they are first class citizens in most of the modern high-level languages such as Java, all the .NET family (e.g. C++, C# and VB.NET), Python, Ruby, Tcl, Javascript, PHP and of course Perl.

Audience
Programmers and Software Engineers who work in C# or VB.NET and who would like to make text processing or input validation easy.

Objectives

  • To understand how the Regular Expression engine works
  • To learn the syntax of the particular regex flavor used in .NET
  • To be able to write robust Regular Expressions

Course format

  • Duration of the course is 16 academic hours. (Two days)
  • Approximately 40% hands on lab work.

Prerequisite

  • Good command (at least 1 year practical work) in C# or VB.NET

Content

While the implementation of Regular Expressions is different in the various languages and tools they have a large common part. In this course first we'll learn the generic approach to regular expressions and then dive into the specific issues related to regex in .NET. In addition we'll look at how to use regular expressions in the tools we use, such as editors, IDEs, etc.

During the class we will explore the algorithm used internally by the .NET regex engines. Understanding this algorithm will allow us to build better regular expressions, to know which one of the matches will be found among several possibilities, and which regexes will be faster than others.

During this discussion we will pause to discuss practical applications and observe common mistakes. We will examine the frequently misunderstood concept of greed, and how does it work combined with eagerness.

We will look at examples for applying regular expressions on Unicode characters with a focus on how to deal with Hebrew text. We'll also look at a number of examples for solving common problems.

Syllabus

  • Introduction to Regular Expressions - Simple Regexes
  • Overview of various tools (egrep, vi, .NET, Java, Perl)
  • Inside the Regex Engine
  • Backtracking
  • Quantifiers
  • Greed
  • Anti-greed
  • Anchors
  • Back-references
  • Mastering Regular Expressions
  • Global Matching
  • Substitution
  • Common Mistakes
  • Crafting your regular expression
  • Debugging regular expressions
  • Examples
  • Exercises
  • Sexeger

Request more information about Regular Expressions for .NET programmers