14.7 Regular Expressions, Class Pattern and Class Matcher
A regular expression is a
String that describes a search pattern for matching characters in other
Strings. Such expressions are useful for validating input and ensuring that data is in a particular format. For example, a ZIP code must consist of five digits, and a last name must contain only letters, spaces, apostrophes and hyphens. One application of regular expressions is to facilitate the construction of a compiler. Often, a large and complex regular expression is used to validate the syntax of a program. If the program code does not match the regular expression, the compiler knows that there’s a syntax error in the code.
String provides several methods for performing regular-expression ...