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.


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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.