I have a wrapper class for matching regular expressions. Obviously, you are compiling a regex in Patternlike this.
Pattern pattern = Pattern.compile(regex);
But suppose I used .*to indicate any number of characters. So this is basically a template.
Pattern pattern = Pattern.compile(".*");
Does the template optimize to always return true and not calculate anything? Or do I need my shell to implement this optimization? I do this because I can easily handle hundreds of thousands of regular expression operations in the process. If the regex parameter is zero, I will combine it with.*
source
share