A pattern normally matches characters in the input string. Anchors do not match characters. Instead, they limit where the pattern is allowed to begin or end in the input. If the pattern is not in the required position, the match fails.
Start Anchors
The ^ anchor requires the pattern to begin at the start of the input string. If any characters appear before the pattern, the match fails.
Using the ^ and $ anchors together requires the entire input string to match the pattern exactly. No characters are allowed before or after the pattern.
The input must be exactly one word character followed by one digit, for the match to succeed.
Return Data:
True
False
Word and Non-Word Boundaries
Word Boundaries
A word boundary anchor, expressed by \\b, matches a position between word and non-word characters, allowing patterns to match whole words but not substrings within larger words.
A non-word boundary anchor, expressed by \\B, matches a position that is not between word and non-word characters, allowing patterns to match substrings within larger words while preventing matches at word boundaries.