# Uses of Class
java.util.regex.Pattern

Packages that use Pattern
Package
Description
java.util
Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes.
java.util.regex
Classes for matching character sequences against patterns specified by regular expressions.

## Uses of Pattern in java.util

Methods in java.util that return Pattern
Modifier and Type
Method
Description
`Pattern`
Scanner.`delimiter()`
Returns the `Pattern` this `Scanner` is currently using to match delimiters.
Methods in java.util with parameters of type Pattern
Modifier and Type
Method
Description
`Stream<MatchResult>`
Scanner.`findAll(Pattern pattern)`
Returns a stream of match results from this scanner.
`String`
Scanner.`findInLine(Pattern pattern)`
Attempts to find the next occurrence of the specified pattern ignoring delimiters.
`String`
Scanner.`findWithinHorizon(Pattern pattern, int horizon)`
Attempts to find the next occurrence of the specified pattern.
`boolean`
Scanner.`hasNext(Pattern pattern)`
Returns true if the next complete token matches the specified pattern.
`String`
Scanner.`next(Pattern pattern)`
Returns the next token if it matches the specified pattern.
`Scanner`
Scanner.`skip(Pattern pattern)`
Skips input that matches the specified pattern, ignoring delimiters.
`Scanner`
Scanner.`useDelimiter(Pattern pattern)`
Sets this scanner's delimiting pattern to the specified pattern.

## Uses of Pattern in java.util.regex

Methods in java.util.regex that return Pattern
Modifier and Type
Method
Description
`static Pattern`
Pattern.`compile(String regex)`
Compiles the given regular expression into a pattern.
`static Pattern`
Pattern.`compile(String regex, int flags)`
Compiles the given regular expression into a pattern with the given flags.
`Pattern`
Matcher.`pattern()`
Returns the pattern that is interpreted by this matcher.
Methods in java.util.regex with parameters of type Pattern
Modifier and Type
Method
Description
`Matcher`
Matcher.`usePattern(Pattern newPattern)`
Changes the `Pattern` that this `Matcher` uses to find matches with.