Fix syntax for the "~/[foo].txt" case

Thanks to my local regexp wizard, @Osse, for helping me coming up with
the proper regexp.

References #82.