12. Regular Expressions

Overview

This chapter discusses regular expressions and considers both how and why they are so useful in Java. To begin, you will first explore how to construct these expressions in order to search for information in your program—a fundamental skill for any developer. When you have a firm understanding of the nature and function of these regular expressions, you will be able to use them to perform simple full-body matches in your search, and, later in the chapter, to extract substrings from a text using groups and non-capturing groups. In the final exercise, you have to employ all of these skills to perform recursive matches and extract a set of similar elements (i.e. a pattern) from a text.

Introduction

In your ...

Get The Java Workshop now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.