Change exclude regexp to only match full directory names

Fixes the issue where, for example, excluding `log` would also exclude `backlog`.

Also updates the test so it tests how the regexp works against a path.

There's one bug I've not managed to fix and which still fails one of the tests, where it won't match an excluded dir if it appears right at the start of the string. This is because Go's regexp implementation doesn't like it when you use `\A` or `\B` in a character class, and also because it doesn't support negative lookaheads (to get around the fact that a `.` is a word boundary, and we don't want that).