Regular expressions are made up of two types of characters: normal text characters, called literals, and special characters, such as the asterisk (*, +, ?, .), called metacharacters. There are times when you want to match a metacharacter as a literal character. In such cases, we prefix that metacharacter with a backslash (\), which is called an escape sequence.
The basic regular expression construct can be summarized as follows:
Here is the list of metacharacters, also known as special characters, that are used in building regular expressions:
\ ^ $ . [ ] | ( ) * + ?
The following table lists the remaining elements that are used in building a basic regular expression, apart from the metacharacters mentioned before:
Literal |
A literal character (non-metacharacter ), such as A, that matches itself. |
Escape... |