Character sets

The operators in Table 10-8 match text.

Table 10-8. Regular expression character sets

Regular expression

Description

[abc]
[a-z]

Match any single character from among listed characters (abc) or from among the characters comprising a range (a–z).

[^abc]
[^a-z]

Match any single character not among listed characters or ranges.

.

Match any single character except a newline.

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.