Home Reverse colors Help
Single page Previous Contents Next

Introduction to GNU/Linux
64 / 102

Regular expressions

Filename expansion belongs to the shell. There is a more general and widely used tool for matching strings, called regular expressions. There are mainly three flavors:

Regular Expressions
Expression Match
. Matches any single character.
* Matches the last character or expression 0 or more times.
+ Matches the last character or expression 1 or more times.
? Matches the last character or expression 0 or 1 time.
^ Matches the beginning of a line.
$ Match the end of a line.
[abcde] Matches exactly one character listed.
[a-e] Matches exactly one character in the given range.
[^abcde] any character that is not listed
[^a-e] any character that is not in the given range
\ Escapes special characters.

Previous Contents Next
Contact