The .NET Framework Class Library (FCL) includes the
System.Text.RegularExpressions namespace, which is devoted to creating, executing, and obtaining results from regular expressions executed against a string.
Regular expressions take the form of a pattern that matches zero or more characters within a string. The simplest of these patterns, such as
.* (which matches anything except newline characters) and
[A-Za-z] (which matches any letter) are easy to learn, but more advanced patterns can be difficult to learn and even more difficult to implement correctly. Learning and understanding regular expressions can take considerable time and effort, but the work will pay off.
Two books that will help you learn and expand your understanding of regular expressions are Michael Fitzgerald’s Introducing Regular Expressions and Jan Goyvaerts and Steven Levithan’s Regular Expressions Cookbook, both from O’Reilly.
Regular expression patterns can take a simple form—such as a single word or character—or a much more complex pattern. The more complex patterns can recognize and match such items as the year portion of a date, all of the
<SCRIPT> tags in an ASP page, or a phrase in a sentence that varies with each use. The .NET regular expression classes provide a very flexible and powerful way to perform tasks such as recognizing text, replacing text within a string, and splitting up text into individual sections based on one or more complex delimiters. ...