Pattern (String pattern) { if (!Comparing.strEqual(pattern, myPattern)) { myCompiledPattern = null; myPattern = pattern; } if (myCompiledPattern == null) { final String regex = "^.*" + NameUtil.buildRegexp(pattern, 0, true, true); final Perl5Compiler compiler = new Perl5Compiler(); try { myCompiledPattern = compiler.compile(regex); } catch (MalformedPatternException ignored) { } } return myCompiledPattern; }