Fixes filename regex error.

Resolves #250.
Ported changes to Document.