Regular Expressions
A regular expression (or regex for short) is a special type of pattern-matching string that can be very useful for programs that do string manipulation. Regular expression strings contain special pattern-matching characters that can be matched against another string to see whether the other string fits the pattern. Regular expressions are very handy for doing complex data validation, such as making sure that users enter properly formatted phone numbers, e-mail addresses, or Social Security numbers, for example.
Regular expressions are also useful for many other purposes, including searching text files to see whether they contain certain patterns, filtering e-mail based on its contents, or performing complicated search-and-replace functions.
This section presents important reference information for forming regular expressions. For information about using regular expressions in a Java program, see Pattern Class and Matcher Class.
string ...
Get Java For Dummies Quick 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.