Regular expressions 3. Anchors

Anchors let you specify a very specific position within the search text.

^ Try to match the (following) regex at the beginning of the string.
    Example: "^ab" matches "ab" only at the beginning of a line and not, for example, in the line "cab".
$ Try to match the (following) regex at the end of the string.
< Try to match the regex at the start of a word.
The character class that defines a word can be found at the convenience escape sequences page.
> Try to match the regex at the end of a word.
\B Not a word boundary

Links to this page


© DAvid Weenink & Paul Boersma 20180401