Chapter 13. Regular Expressions

THIS chapter explains how to use the java.util.regex API[1] for pattern matching with regular expressions. Although the syntax accepted by this package is similar to the Perl programming language,[2] knowledge of Perl is not a prerequisite. This chapter starts with the basics and gradually builds to cover more advanced techniques.

Introduction

What Are Regular Expressions?

Regular expressions are a way to describe a set of strings based on common characteristics shared by each string in the set. They can be used to search, edit, or manipulate text and data. You must learn a specific syntax to create regular expressions—one that goes beyond the normal syntax of the Java programming language. Regular expressions vary ...

Get The Java™ Tutorial Fourth Edition: A Short Course on the Basics now with O’Reilly online learning.

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