[.]
is equivalent to escaping the .
(dot) character, i.e. \\.
.
Once the character appears in a character class, it loses its status as a special character.
As foo
doesn't contain any dots, nothing is matched. .+
, on the other hand, is a wildcard greedy expression that matches everything.