课程:正则表达式

原文: 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 编程语言,但 Perl 的知识不是先决条件。本课程从基础知识开始,逐步构建以涵盖更高级的技术。

Introduction

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

Test Harness

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

String Literals

Introduces basic pattern matching, metacharacters, and quoting.

Character Classes

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

Predefined Character Classes

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

Quantifiers

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

Capturing Groups

Explains how to treat multiple characters as a single unit.

Boundary Matchers

Describes line, word, and input boundaries.

Methods of 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.

Methods of the Matcher Class

Describes the commonly-used methods of the Matcher class.

Methods of the PatternSyntaxException Class

Describes how to examine a PatternSyntaxException.

Additional Resources

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