Up until now, we have been using wildcards with filenames. Regular expressions (Regex for short) is another Linux feature that will allow you to search for a specific pattern in text files. Regex is also often used with the grep command.
Table 15 lists the most common regular expressions and their uses:
Regex | What it does |
* | Matches zero or more of the preceding characters or expressions. |
+ | Matches one or more of the preceding characters or expressions. |
. | Matches any single character. Same as the ? wildcard. |
^ | Matches the following expression at the beginning of the line. For example, ^dog will match all lines that begin with the word dog. |
$ | Matches the preceding expression at the end of the line. For example, bird$ will match all lines that end with the word bird. |
\ | Used as an escape character to match a special character following the backslash. For example, \* matches a star (asterisk). |
[characters] | Matches the characters that are members of the... |