Documentation > Regular Expressions > Anchors ^ and $
Anchors ^ and $
Anchors match at the beginning of a file, a line, or a word. All of them are “zero-width”, that is, they don't match any characters in the source file.
^^ |
The beginning of a file |
$$ |
The end of a file |
^ |
The beginning of a line |
$ |
The end of a line |
\< |
The beginning of a word |
\> |
The end of a word |
For example:
^From |
A line starting with “From” |
ing\> |
A word ending with “ing” |
^abc$ |
A line containing only “abc” |
^#include |
A line starting with “#include” |
^$ |
An empty line |
^^$$ |
An empty file |
