Name

java.lang.String

Description

New methods for pattern matching.

Methods

boolean matches (String regex)

Return true if regex matches the entire String.

String[ ] split (String regex)

Return an array of the substrings surrounding matches of regex.

String [ ] split (String regex, int limit)

Return an array of the substrings surrounding the first limit-1 matches of regex.

String replaceFirst (String regex, String replacement)

Replace the substring matched by regex with replacement.

String replaceAll (String regex, String replacement)

Replace all substrings matched by regex with replacement.

Get Regular Expression Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.