Appendix . Bonus Chapter: Regular Expressions

For most of Java’s existence, search-and-replace operations that could be accomplished in a single line of Perl code were an arduous undertaking in Java because it lacked support for regular expressions, a sophisticated form of text processing.

The Java class library includes robust support for regular expressions with the java.util.regex package and additional methods in several classes that handle characters.

In this bonus chapter, you’ll learn how to use these features as the following topics are covered:

  • How to create and use regular expressions

  • How to find a pattern in a line of text

  • How to split text into smaller strings delimited by regular expressions

Introduction to Pattern Matching

The most popular ...

Get Sams Teach Yourself Java™ 6 in 21 Days 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.