Team LiB
Previous Section Next Section

Using Regular Expressions

The .NET Framework provides rich regular expression support and functionality within the base class library. Previously, regular expressions were only supported via third-party libraries for languages such as C++ and Visual Basic. In .NET, the regular expression syntax is fully supported and there are a number of classes in the System.Text.RegularExpressions namespace geared to leveraging this powerful string processing language.

Understanding Expression Syntax

The hardest part of using regular expressions in .NET is to first gain an understanding of the language. Unlike C#, the syntax for regular expressions is somewhat cryptic and takes time and practice to understand and apply it correctly.

The language itself is based on a set of escape sequences. These escape sequences translate into patterns that are applied to recognizing items within a source string. Each escape sequence has a particular meaning and often works in combination with other elements to create the overall expression. The best way to learn the language of regular expressions is to jump in with both feet.

    Team LiB
    Previous Section Next Section