Team LiB
Previous Section Next Section

How this Book is Structured

This book has five chapters and three appendixes. It's intended to be a progressive learning experience, so the chapters build on each other. I describe the contents of the chapters and appendixes in the following sections.

Chapter 1

This chapter introduces regular expressions and provides some simple examples and explanations to get you started. It explores the J2SE regular expression syntax, operations, and differences from regular expressions you might already be familiar with from other languages. It also offers a tutorial on regular expressions.

Even if you have a background in regular expressions, I suggest you look over the examples in this chapter—there are a lot of different regular expression flavors, and there's rarely an isomorphic mapping between them. Chapter 1 is a natural starting point if you're new to regular expressions in J2SE or if you need a refresher on regular expressions in general.

Chapter 2

Chapter 2 introduces the built-in Java support for regular expressions through the Pattern and Matcher classes. Each method and attribute is dissected in detail, and all but the most trivial have companion code examples that highlight appropriate usage. Chapter 2 covers which settings and flags might affect the efficiency of your code. Additionally, Chapter 2 details the five new methods on the String class that support regular expressions, and offers advice and examples regarding appropriate usage.

Chapter 3

Chapter 3 expounds on some advanced regular expression concepts, including groups, noncapturing groups, greedy qualifiers, positive qualifiers, reluctant qualifiers, possessive qualifiers, positive lookarounds, negative lookarounds, positive lookbehinds, and negative lookbehinds. It provides numerous examples and detailed explanations regarding how these concepts work and how they might benefit you in your day-to-day tasks.

Chapter 4

Chapter 4 offers advice and suggestions on using regular expressions in Java's object-oriented environment. The chapter covers best practices, examples, and lessons learned from similar packages.

Chapter 5

Chapter 5 provides numerous full-featured examples, with accompanying explanations and code, that build on the material presented in previous chapters. Chapter 5 is designed to illustrate the development process I use when I'm trying to solve a regular expression problem in Java.

Appendix A

Appendix A offers a complete listing, with explanation, of the regular expression syntax and various regular expression metacharacters.

Appendix B

Appendix B provides a summary of the methods of the Pattern and Matcher classes in Java.

Appendix C

Appendix C offers simple regular expressions, without accompanying code, to help with everyday, common tasks such as validating e-mails, checking text for format, extracting values, and so on.


Team LiB
Previous Section Next Section