In order to express more general patterns than just literals, some specific
characters have been defined. For example, the character "." as a
regular expression matches any single character. The regular expression
"a.b" matches "a+b", "aZb", and similar strings.
The "." and other reserved characters are called metacharacters. The
special meaning of any metacharacter can be turned off by preceding it with
the escape character "\". Thus, "\." matches the literal
period character and "\\" matches the literal backslash.
Two positional metacharacters exist. "^" matches the beginning of
a line: "^HP" is a regular expression that matches "HP" only
if it occurs as the first two characters of the line. Similarly, "$"
matches the end of a line: "HP$" matches "HP" only if it
is the last thing on a line. Of course, these can work together: "^HP$"
matches a line that contains only "HP".