# 课程：正则表达式

> 原文： [https://docs.oracle.com/javase/tutorial/essential/regex/index.html](https://docs.oracle.com/javase/tutorial/essential/regex/index.html)

本课程介绍如何使用 `[`java.util.regex`](https://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html)`API 与正则表达式进行模式匹配。虽然此程序包接受的语法类似于 [Perl](http://www.perl.com) 编程语言，但 Perl 的知识不是先决条件。本课程从基础知识开始，逐步构建以涵盖更高级的技术。

[Introduction](intro.html)

Provides a general overview of regular expressions. It also introduces the core classes that comprise this API.

[Test Harness](test_harness.html)

Defines a simple application for testing pattern matching with regular expressions.

[String Literals](literals.html)

Introduces basic pattern matching, metacharacters, and quoting.

[Character Classes](char_classes.html)

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

[Predefined Character Classes](pre_char_classes.html)

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

[Quantifiers](quant.html)

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

[Capturing Groups](groups.html)

Explains how to treat multiple characters as a single unit.

[Boundary Matchers](bounds.html)

Describes line, word, and input boundaries.

[Methods of the Pattern Class](pattern.html)

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

[Methods of the Matcher Class](matcher.html)

Describes the commonly-used methods of the `Matcher` class.

[Methods of the PatternSyntaxException Class](pse.html)

Describes how to examine a `PatternSyntaxException`.

[Additional Resources](resources.html)

To read more about regular expressions, consult this section for additional resources.