Regular Expressions

This section teaches the regular expression syntax supported by the java.util.regex API and presents several working examples to illustrate how the various objects interact.


  1. Introducing Regular Expressions

    Introducing regular expressions: what are they and what you can do with them. Includes the code used to test regular expressions, used throughout this section.

  2. String Literals

    Introduces basic pattern matching, metacharacters, and quoting.

  3. Character Classes

    Describes simple character classes, negation, ranges, unions, intersections, and subtraction.

  4. Predefined Character Classes

    Describes the basic predefined character classes for whitespace, word, and digit characters.

  5. Quantifiers

    Explains greedy, reluctant, and possessive quantifiers for matching a specified expression x number of times.

  6. Capturing Groups

    Explains how to treat multiple characters as a single unit.

  7. Boundaries

    Describes line, word, and input boundaries.

  8. The Pattern Class

    Examines other useful methods of the Pattern class, and explores advanced features such as compiling with flags and using embedded flag expressions.

  9. The Matcher Class

    Describes the commonly-used methods of the Matcher class.

  10. Methods of the PatternSyntaxException Class

    Describes how to examine a PatternSyntaxException.



Back to Tutorial List