If each file or directory name consists entirely of \w then constructing Regular Expressions is dead easy. Permit hyphens, and right away everything has to change from \w to [\w-]. Permit additional punctuation and soon you are into [^blahblah] territory instead.
Literal periods are particularly troublesome because they do have meaning as punctuation: separating the various components of the hostname at one end of the URL; separating filename from extension at the other end. So you're on a three-way toggle between "means A", "means B", and "means nothing".
Anyway, the Great Divide is that a lowline is \w while all other punctuation is \W