6. 非Posix基本正则表达式

Non POSIX Basic Regular Expression Syntax: An additional non-POSIX class understood by some tools is [:word:], which is usually defined as [:alnum:] plus underscore. This form of regular expression is used to reflect the fact that in many programming languages these characters may be used in identifiers.

Operators
Operator Effect
. The dot operator matches any single character.
[ ] boxes enable a single character to be matched against a character lists or character range.
[^ ] A compliment box enables a single character not within in a character list or character range to be matched.
* An asterisk specifies zero or more characters to match.
^ The caret anchor matches the beginning of the line
$ The dollar anchor matches the end of the line

The editor vim further distinguishes word and word-head classes (using the notation \w and \h) since in many programming languages the characters that can begin an identifier are not the same as those that can occur in other positions.

(For an ASCII chart color-coded to show the POSIX classes, see ASCII.)

Use in Tools

Tools and languages that utilize this regular expression syntax include:

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注