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.
^^ or \A |
The beginning of a file |
$$ or \Z |
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 |
\b |
Word boundary (beginning or end) |
\B |
Not word boundary (between two letters or two spaces) |
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 |
ing\> |
A word ending with “ing” |
ing\b |
The same thing |
This is a page from Aba Search and Replace help file.