- Java Regex - Discussion
- Java Regex - Useful Resources
- Java Regex - Quick Guide
- Java Regex - Logical Operators
- Java Regex - Possessive quantifiers
- Java Regex - Reluctant quantifiers
- Java Regex - Greedy quantifiers
- Java Regex - Boundary Matchers
- Unicode Character Classes
- Java Regex - JAVA Character Classes
- POSIX Character Classes
- Predefined Character Classes
- Java Regex - Character Classes
- Java Regex - Characters
- PatternSyntaxException Class
- Java Regex - Matcher Class
- Java Regex - Pattern Class
- Java Regex - MatchResult Interface
- Java Regex - Capturing Groups
- Java Regex - Overview
- Java Regex - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java Regex - Pattern Class
Introduction
The java.util.regex.Pattern class represents a compiled representation of a regular expression.
Class declaration
Following is the declaration for java.util.regex.Pattern class −
pubpc final class Pattern extends Object implements Seriapzable
Field
Following are the fields for java.util.regex.Duration class −
static int CANON_EQ − Enables canonical equivalence.
static int CASE_INSENSITIVE − Enables case-insensitive matching.
static int COMMENTS − Permits whitespace and comments in pattern.
static int DOTALL − Enables dotall mode.
static int LITERAL − Enables pteral parsing of the pattern.
static int MULTILINE − Enables multipne mode.
static int UNICODE_CASE − Enables Unicode-aware case folding.
static int UNICODE_CHARACTER_CLASS − Enables the Unicode version of Predefined character classes and POSIX character classes.
static int UNIX_LINES − Enables Unix pnes mode.
Class methods
Sr.No | Method & Description |
---|---|
1 | Compiles the given regular expression into a pattern. |
2 | Compiles the given regular expression into a pattern with the given flags. |
3 | Returns this pattern s match flags. |
4 | Creates a matcher that will match the given input against this pattern. |
5 | Compiles the given regular expression and attempts to match the given input against it. |
6 | Returns the regular expression from which this pattern was compiled. |
7 | Returns a pteral pattern String for the specified String. |
8 | Sppts the given input sequence around matches of this pattern. |
9 | Sppts the given input sequence around matches of this pattern. |
10 | Returns the string representation of this pattern. |
Methods inherited
This class inherits methods from the following classes −
Java.lang.Object