A lot of you may be wondering why you should care about "Regular Expressions" ... or you might even be wondering what they are. Regular expressions search and select text. This "specialty technology" is taking on new meaning because text is coming back. Technologies like XML and Web Services are using text rather than binary files to get through the firewalls and bridge the differences between different systems. Java and .NET can't share a lot of things, but they can both process text.
Regular Expressions are useful! But there's a catch ...
Do you need to process a huge file of log records to look for a particular type of error? Regular expressions might be the fastest way. Does your program need to check that a ID string has an exact format? Do it with a regular expression in your code. The "regular expressions" that most of us are most likely to use on a day-to-day basis are the DOS file path expressions where the "?" wildcard (more formally, "metacharacter") is used to match any single alphabetic character in a DOS file path expression.
You can learn more about regular expressions here at About Visual Basic in the article, Introduction to Regular Expressions in Visual Basic.
But, as Andrew Watt states in the new Wrox book, Beginning Regular Expressions, "... many developers find regular expressions intimidating ..." You got that right, Andrew! Regular expressions can be like extreme sushi. You have to develop a taste.
A big part of the problem is that there is no standard for regular expressions. They're defined by the applications that they're in. As Watt states the problem, "there is a very rough 'understanding' in the programming community about what they are. Consequently, a regular expression in one langauge might not work at all in another."
Andrew Watt to the rescue
The world has needed a book that presents a unified view in spite of the wide differences. This book covers those different technologies with absolute precision, completeness, and accuracy - just like a regular expression would process a file - but the book isn't always easy to understand - again, just like regular expressions.
There is one plus for Visual Basic developers. Watt states right up front that, "This book is targeted at developers who use Windows as their primary or only operating system." That would be us!
But "Beginning" ??? Almost 800 pages of densely packed information and this is a "beginning"? It makes me wonder what an "advanced" book must look like. But once you get into it, you discover that this book really is for people just starting out - even though they may have a few problems too.
Sometimes, it's a bit too much of a "beginner" book. Watt goes over a lot of information that someone with even limited experience already knows about. For example, in Chapter 1, he covers how to use "Find" in Word, complete with a downloadable test file containing just four words. And he points out - several times - that a file in a DOS command must be qualified or in the same directory.
A book with a unique style
Another way that the book is for beginners is that Watt steps through each of his examples completely - like a computer would actually. In one example after another, the text starts at the beginning of the same word and explains how a regular expression matches each character - even though much of it has nothing to do with the example. You actually find yourself learning about how regular expressions work just from the writing style of the book.
If you have ever found yourself wishing for a book that doesn't leave any of the steps ... this is your book!
It's not a book that you can read cover to cover. For example, early in the book, he uses regular expression "character classes", without explaining what they are. (Watt does devote an entire chapter to character classes later on.) It's a much better reference since it covers the use of regular expressions in a wide variety of software from Microsoft Office applications like Word to more technical applications like XML Schema, Perl (the original source of regular expressions) and .NET. In fact, the chapters on the use of regular expressions in both VBScript and VB.NET are very good!
Summary and Book Details
If you're looking for comprehensive coverage of virtually all of the regular expression technologies that will run in a Windows environment and one that won't leave you wondering how to get from one step to the next, try this one!
Beginning Regular Expressions (Programmer to Programmer)
by Andrew Watt
- List Price: $39.99 - 768 pages - January 2005 - ISBN: 0764574892