站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Java Regular Expressions: Taming the java.util.regex Engine

Chapter 5: Practical Examples - Java Regular Expressions: Taming the java.util.regex Engine

Previous Section Next Section

Chapter 5: Practical Examples

Overview

"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?/td>

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.


Previous Section Next Section