Conceptual

Anchors and Word Boundaries in Regex

^ and $ pin a pattern to the start and end of a string, and \b pins it to a word edge. Without them a pattern matches anywhere inside a larger string, which is why a validator that accepts 'abc123def' when it meant to accept '123' is almost always missing an anchor.