Java Reference
In-Depth Information
The
Pattern
class has the following methods:
public static Pattern
compile(String regex)
tHRows PatternSyntaxEx-
ception
Compiles the given regular expression into a pattern.
public static Pattern
compile(String regex, int flags)
tHRows Pat-
ternSyntaxException
Compiles the given regular expression into a pattern with the
given flags. The flags control how certain interesting cases are
handled, as you will soon learn.
public String
pattern()
Returns the regular expression from which this pattern was
compiled.
public int
flags()
Returns this pattern's match flags.
public Matcher
matcher(CharSequence input)
Creates a matcher that will match the given input against this
pattern.
public String[]
split(CharSequence input, int limit)
A convenience method that splits the given input sequence
around matches of this pattern. Useful when you do not need
to reuse the matcher.
public String[]
split(CharSequence input)