now it works without the trailing slash. also, regex improvements.
Merge pull request #15 from waynechang/sub

now it works without the trailing slash. also, regex improvements.