Section 14.7 Regular Expressions, Class Pattern and Class Matcher

• Regular expressions (p. 624) are sequences of characters and symbols that define a set of strings. They’re useful for validating input and ensuring that data is in a particular format.

String method matches (p. 624) receives a string that specifies the regular expression and matches the contents of the String object on which it’s called to the regular expression. The method returns a boolean indicating whether the match succeeded.

• A character class is an escape sequence that represents a group of characters. Each character class matches a single character in the string we’re attempting to match with the regular expression.

• A word character (\w; p. 624) is any letter (uppercase ...

Get Java™ How To Program (Early Objects), Tenth Edition 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.