Everything you need to make regular expressions work hides under the System.Text.RegularExpressions namespace. The main class behind this namespace is Regex , which hosts a handful of functions for manipulating text using your expression.
So, how do you write your expression in the first place? Dozens of books, thousands of Web sites, and millions of magazine articles all offer to teach you this very skill. You see, regular expressions are nothing new: they ve been around forever. They have only just been made intrinsically available to the Visual Basic developer, however, through the .NET Framework.
Anyone can learn how to write a regular expression. Looking up regular expressions, overview in the help index will give you a pretty good lowdown, but that s not what this book is about. This book is about providing you with instant solutions to everyday programming problems.
In other words, I m going to show you the exact regular expressions you need to deal with 95% of the situations you ll come across. I ll show you expressions I ve created to search for links in HTML, expressions to check for a correct U.S. or U.K. telephone numbers , expressions to validate the major credit cards, expressions that can enforce secure passwords, and expressions that ensure data is correct and can be used with the RegularExpressionValidator control.
I ll drop in tips on how to personalize the expressions. I ll provide commented sample code to demonstrate how to use these regular expressions in Visual Basic .NET. I ll show you what will create a match and what won t. The hard work has been done ”and all you need to do is take advantage of it. Ready?
|TOP TIP|| |
If you re looking for a solid tutorial on regular expressions, check out Dan Appleman s Regular Expressions with .NET e-book on Amazon.com. It s instantly downloadable and priced at approximately $14. There s also a new, free software package available to help you design and edit your regular expressions. It s called RegexDesigner .NET and is available for download at www.sellsbrothers.com/products/ .