A regular expression is a defined pattern used for matching and manipulating strings. In Java, there is a built-in API for regular expressions:
java.util.regex package
This package has three classes:
This regular expression is not the property of one particular programming language; instead, it is supported by multiple languages.
The util.regex.PatternSyntaxException
is used to indicate errors in a regular expression.
Some commonly used methods are:
Methods | Description |
---|---|
getDescription() |
It returns the description of the error. |
getIndex() |
It returns the index where the error occurred. |
getPattern() |
It returns the expression with the errors. |
getMessage() |
It returns the string containg the description of the array. |
Free Resources