Introduction to Java Regular Expression APIs - Pattern and Matcher Classes

In this chapter, we will introduce you to dedicated Java APIs for writing programs using regular expressions. Java provides a package, java.util.regex, which contains all the classes and interfaces for handling regular expressions. This package is in the java.base module, so we do not explicitly declare its use in the module-info.java source file. The java.base module is automatically required by all modules, and it contains the most important and basic JDK packages and classes. Regular expressions is such an important topic and tool that Java 9 experts decided to keep it inside the java.base module.

We will cover the following classes and interfaces from this package:

  • The MatchResult interface
  • Using Pattern class
  • Using Matcher class
  • Various methods of Pattern and Matcher classes and how to use them for solving problems involving regular expressions
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.14.200