Concept Flow - Anchors (^, $)
Start
Input String
Apply ^ anchor
Match start of string?
No→No match
Yes
Apply $ anchor
Match end of string?
No→No match
Yes
Full match found
End
Anchors ^ and $ check if a pattern matches the start or end of a string in bash regex matching.