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