Memory Refresh

Start of a line

Start of the line

The easiest metacharacters to understand are ^ (caret) and $ (dolar), which represent the start and end of the line of the text being checked.


It's best to get into the habit of interpreting regular expressions in a rather literal way. Don't think: ^cat matches a line with cat at the beginning But rather: ^cat mathces if you have the beginning of a line, followed immediately by c, then a, then t

Literal means

^$ matches if the line has a beginning-of-line, followed immediately by the end of the line Effectively means: an empty line (with nothing on it, not even spaces)
Comments ...