Minggu, 03 Juli 2022

Three Classes Regex In Java.Util. Package

How Are Regular Expressions Represented in This Package?

The java.util.regex package primarily consists of three classes: Pattern, Matcher, and PatternSyntaxException.

A Pattern object is a compiled representation of a regular expression. The Pattern class provides no public constructors. To create a pattern, you must first invoke one of its public static compile methods, which will then return a Pattern object. These methods accept a regular expression as the first argument; the first few lessons of this trail will teach you the required syntax.

A Matcher object is the engine that interprets the pattern and performs match operations against an input string. Like the Pattern class, Matcher defines no public constructors. You obtain a Matcher object by invoking the matcher method on a Pattern object.

A PatternSyntaxException object is an unchecked exception that indicates a syntax error in a regular expression pattern.

Bibliography:

https://docs.oracle.com, https://www.iupui.edu/, Pemrograman Java; R.H. Sianipar, Pemrograman Java; Abdul Kadir, Pemrograman Java; Ir. Yuniar Supardi, Head First Java; Kathy Sierra, Java A Beginner's Guide; Herbert Schildt

Related Post:

Tidak ada komentar:

Posting Komentar

Various Other Posts