Skip to content

Most visited

Recently visited

navigation
Added in API level 1

PatternSyntaxException

public class PatternSyntaxException
extends IllegalArgumentException

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ java.lang.RuntimeException
         ↳ java.lang.IllegalArgumentException
           ↳ java.util.regex.PatternSyntaxException


Encapsulates a syntax error that occurred during the compilation of a Pattern. Might include a detailed description, the original regular expression, and the index at which the error occurred.

See also:

Summary

Public constructors

PatternSyntaxException(String description, String pattern, int index)

Creates a new PatternSyntaxException for a given message, pattern, and error index.

Public methods

String getDescription()

Returns the description of the syntax error, or null if the description is not known.

int getIndex()

Returns the character index around which the error occurred, or -1 if the index is not known.

String getMessage()

Returns a detailed error message for the exception.

String getPattern()

Returns the syntactically incorrect regular expression.

Inherited methods

From class java.lang.Throwable
From class java.lang.Object

Public constructors

PatternSyntaxException

Added in API level 1
PatternSyntaxException (String description, 
                String pattern, 
                int index)

Creates a new PatternSyntaxException for a given message, pattern, and error index.

Parameters
description String: the description of the syntax error, or null if the description is not known.
pattern String: the syntactically incorrect regular expression, or null if the regular expression is not known.
index int: the character index around which the error occurred, or -1 if the index is not known.

Public methods

getDescription

Added in API level 1
String getDescription ()

Returns the description of the syntax error, or null if the description is not known.

Returns
String the description.

getIndex

Added in API level 1
int getIndex ()

Returns the character index around which the error occurred, or -1 if the index is not known.

Returns
int the index.

getMessage

Added in API level 1
String getMessage ()

Returns a detailed error message for the exception. The message is potentially multi-line, and it might include a detailed description, the original regular expression, and the index at which the error occurred.

Returns
String the error message.

getPattern

Added in API level 1
String getPattern ()

Returns the syntactically incorrect regular expression.

Returns
String the regular expression.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.