The operators in Table 10-9 modify the way other operators are interpreted.

Table 10-9. Regular expression modifiers

Basic regular expression

Extended regular expression



Match zero or more of the character that precedes it.


Match zero or one instance of the preceding regex.


Match one or more instances of the preceding regex.


Match a range of occurrences of the single character or regex that precedes this construct. \{n\} matches n occurrences, \{n,\} matches at least n occurrences, and \{n,m\} matches any number of occurrences between n and m, inclusively.


Match the character or expression to the left or right of the vertical bar.


Matches regex, but it can be modified as a whole and used in back-references. (\1 expands to the contents of the first \(\) and so on up to \9.)

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.