Step: Anchors: ^ $ and \b

Anchors: ^ $ and \b

Anchors match a position, not a character: ^ = start, $ = end, \b = a word boundary.

Why it matters: anchors stop a pattern from matching in the middle of something — "match a whole line" or "the word at the end".

Example: end$ matches "end" only when it sits at the very end of the string.

Your turn: match the final "end" with end$.

Pitfall: with the m (multiline) flag, ^ and $ match the start/end of each line instead of the whole string.

Input:
end. the end
Expected:
[
  "end"
]
Step 8 of 11