add setRegex method as described in the docs
Adding perf improvement to URI template expansion