"I took a speed reading course and read War and Peace in 20 minutes. It's about Russia."
— Woody Allen
In this chapter, I'll think aloud as I solve several regex problems. This should provide some insight into the process of forming nontrivial regex solutions. Some of these examples are problems that I've found on a regex or Java newsgroup, and others were created for this chapter.
Note |
The problems in this chapter take advantage of the RegexProperties class, which was defined in Chapter 4. RegexProperties is a class that extends java.util.Properties and allows you to load regex patterns from a properties file. The main advantage here is that the patterns don't have to be Java-delimited. Thus, you can actually use \d instead of \\d. For more details on the RegexProperties class, please see Chapter 4. |