Chapter 9. .NET


Microsoft's .NET Framework, usable with Visual Basic, C # , and C++ (among other languages), offers a shared regular-expression library that unifies regex semantics among the languages. It's a full-featured , powerful engine that allows you the maximum flexibility in balancing speed and convenience. [ ]

[ ] This book covers .NET Framework Version 2.0 (which is shipped with "Visual Studio 2005).

Each language has a different syntax for handling objects and methods, but those underlying objects and methods are the same regardless of the language, so even complex examples shown in one language directly translate to the other languages of the .NET language suite. Examples in this chapter are shown with Visual Basic.

Reliance on Earlier Chapters Before looking at what's in this chapter, it's important to emphasize that it relies heavily on the base material in Chapters 1 through 6. I understand that some readers interested only in .NET may be inclined to start their reading with this chapter, and I want to encourage them not to miss the benefits of the preface (in particular, the typographical conventions) and the earlier chapters: Chapter 1, 2, and 3 introduce basic concepts, features, and techniques involved with regular expressions, while Chapter 4, 5, and 6 offer important keys to regex understanding that directly apply to .NET's regex engine. Among the important concepts covered in earlier chapters are the base mechanics of how an NFA regex engine goes about attempting a match, greediness , backtracking, and efficiency concerns.

Along those lines, let me emphasize that despite convenient tables such as the one in this chapter on page 407, or, for example, ones in Chapter 3 such as those on pages 114 and 123, this book's foremost intention is not to be a reference, but a detailed instruction on how to master regular expressions.

This chapter first looks at .NET's regex flavor, including which metacharacters are supported and how, as well as the special issues that await the .NET programmer. Next is a quick overview of .NET's regex-related object model, followed by a detailed look at each of the core regex- related classes. It ends with an example of how to build a personal regex library by encapsulating prebuilt regular expressions into a shared assembly.



Mastering Regular Expressions
Mastering Regular Expressions
ISBN: 0596528124
EAN: 2147483647
Year: 2004
Pages: 113

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net