O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

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

Regular Expression Support

Regular expressions have been used in various programming languages and tools for many years. The FCL includes a set of classes for utilizing the power of regular expressions that are designed to be compatible with Perl 5 regular expressions. In addition, the regular expression classes implement some additional functionality, such as named capture groups, right-to-left pattern matching, and expression compilation.

Regular expression knowledge seems to be one of those topics that most programmers have learned and then forgotten more than once. For the purposes of this chapter, we presume some previous use and experience with regular expressions within Perl 5. The .NET regexp classes are a superset of Perl 5 functionality, so this will serve as a good conceptual starting point.

For readers new to regular expressions, we suggest starting with some basic Perl 5 introductions. The http://perl.com site has some great resource materials and introductory tutorials. In addition, the definitive work on regular expressions is Mastering Regular Expressions, by Jeffrey E. F. Friedl (O’Reilly & Associates, 1997). For those who want to get the most out of working with regular expressions, this book is highly recommended.

The Regex Class

The Regex class is the heart of the BCL regular expression support. Used both as an object instance and as a static type, the Regex class represents an immutable, compiled instance of a regular expression that can be applied to a string via ...

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