Anchors do not consume characters; they assert something about the current position in the input. The caret ^ matches the start of the string by default, and with the m flag it also matches the start of each line following a newline. The dollar sign \( matches the end of the string, and with the m flag it also matches just before any newline. Be aware that in JavaScript, even without the m flag, \) will still match before a final newline in some engines, which is a subtle source of off-by-one bugs. For unambiguous absolute positions, PCRE and Python provide \A for the strict start of input and \z for the strict end, with \Z matching end-of-string or just before a final newline.
The word boundary \b is one of the most useful zero-width assertions. It matches the position between a word character (matched by \w) and a non-word character, or at the start or end of the string. The pattern \bcat\b therefore matches the standalone word cat but not the cat inside concatenate. The negation \B matches anywhere that is not a word boundary, which lets you write \Bcat\B to find the substring cat only when it is embedded inside a longer word. Word boundaries are invaluable when searching for keywords in text, because they let you avoid partial matches without listing all possible surrounding characters.
Anchors behave differently inside character classes, and this is a frequent source of confusion. Outside a class, ^ is the start anchor; inside [...], when it is the first character, it negates the class so [^a-z] matches anything that is not a lowercase ASCII letter. Outside a class, \( is the end anchor; inside [\^\)] it is a literal caret or dollar sign. A common idiom ^|$ matches the start or end of a line in multiline mode, but it is sometimes mistakenly written as a character class, which would match a literal caret or dollar sign instead. When in doubt, prefer explicit anchors like \A and \z when you want true start-of-string and end-of-string semantics that no flag can change.