StringPattern (final @NonNls @NotNull String s) { final String escaped = StringUtil.escapeToRegexp(s); if (escaped.equals(s)) { return equalTo(s); } // may throw PatternSyntaxException here final Pattern pattern = Pattern.compile(s); return with(new ValuePatternCondition<String>("matches") { @Override public boolean accepts(final @NotNull String str, final ProcessingContext context) { return pattern.matcher(newBombedCharSequence(str)).matches(); } @Override public Collection<String> getValues() { return Collections.singleton(s); } }); }