ANCHORS & BOUNDARIES
Start and end
^ pins the match to the start of the line, $ to the end.
Anchors match positions, not characters. ^ is the position before the first character, $ the position after the last. ^TODO matches TODO only when it starts the line; ;$ matches a semicolon only when it ends the line. ^$ matches an empty line - two positions, zero characters between them.
By default ^ and $ mean start and end of the WHOLE string. With the m (multiline) flag they match at every line break - that is what you want when scanning files. MDN: multiline.
PRACTICE - 2 DRILLS 0/2 DONE
Match TODO, but only when the line starts with it.
/ /
TODO: fix this
must match: "TODO"
// TODO later
must match nothing
TODO
must match: "TODO"
Match a semicolon, but only when it is the last character on the line.
/ /
let x = 1;
must match: ";"
a; b; c;
must match: ";"
no semicolon
must match nothing