Chapter 2

Using Regular Expressions

IN THIS CHAPTER

check Introducing regular expressions

check Trying out regular expressions with a helpful program

check Creating simple expressions that match patterns of characters

check Using regular expression features such as custom classes, quantifiers, and groups

check Using regular expressions with the String class

check Using the Pattern and Matcher classes for more-extensive regular expressions

Regular expressions are not expressions that have a lot of fiber in their diet. Instead, a regular expression 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. You’ll find that regular expressions are very handy for doing complex data validation — for making sure ...

Get Java All-in-One For Dummies, 5th 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.