Optimize cookie regex, fix GH issue #46