Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

# java.util.regex

Classes for matching character sequences against patterns specified by regular expressions.

An instance of the `https://developer.android.com/reference/java/util/regex/Pattern` class represents a regular expression that is specified in string form in a syntax similar to that used by Perl.

Instances of the `https://developer.android.com/reference/java/util/regex/Matcher` class are used to match character sequences against a given pattern. Input is provided to matchers via the `https://developer.android.com/reference/java/lang/CharSequence` interface in order to support matching against characters from a wide variety of input sources.

Unless otherwise noted, passing a `null` argument to a method in any class or interface in this package will cause a `https://developer.android.com/reference/java/lang/NullPointerException` to be thrown.

## Related Documentation

An excellent tutorial and overview of regular expressions is [*Mastering Regular Expressions*, Jeffrey E. F. Friedl, O'Reilly and Associates, 1997.](http://www.oreilly.com/catalog/regex/)

## Interfaces

|---|---|
| [MatchResult](https://developer.android.com/reference/java/util/regex/MatchResult) | The result of a match operation. |

## Classes

|---|---|
| [Matcher](https://developer.android.com/reference/java/util/regex/Matcher) | An engine that performs match operations on a [character sequence](https://developer.android.com/reference/java/lang/CharSequence) by interpreting a `https://developer.android.com/reference/java/util/regex/Pattern`. |
| [Pattern](https://developer.android.com/reference/java/util/regex/Pattern) | A compiled representation of a regular expression. |

## Exceptions

|---|---|
| [PatternSyntaxException](https://developer.android.com/reference/java/util/regex/PatternSyntaxException) | Unchecked exception thrown to indicate a syntax error in a regular-expression pattern. |

-

  ## Interfaces

  - [MatchResult](https://developer.android.com/reference/java/util/regex/MatchResult)
-

  ## Classes

  - [Matcher](https://developer.android.com/reference/java/util/regex/Matcher)
  - [Pattern](https://developer.android.com/reference/java/util/regex/Pattern)
-

  ## Exceptions

  - [PatternSyntaxException](https://developer.android.com/reference/java/util/regex/PatternSyntaxException)