BASICS
The dot
The dot matches any single character, exactly one.
h.t matches hat, hot, hit, and even "h t". The dot . is the first metacharacter - a character with a special job instead of standing for itself. It matches any single character except a line break, and does not care which one. To match a literal dot, you escape it.
Exactly one is the key. h.t does not match "heat" (two characters between h and t) or "ht" (zero).
The dot deliberately stops at line breaks. To let it span newlines too, add the s (dotAll) flag: /a.b/s. A portable alternative that needs no flag is [\s\S] - it comes naturally once character classes land. MDN: dotAll.
Match hat, hot, hit and any other h_t triple with one character in the middle.
the hat and the hot hit
h t
heat is not a triple
ht is too short
Match big, bug, bog and any other b_g triple with exactly one character in the middle.
a big bug in the bag
the bog by the log
beg pardon
no triple in this row