code: public static boolean textMatchesWithANY(String haystack, String needle) {
      haystack = haystack.trim();
      needle = needle.trim();
  
      // Make sure we escape every character that is considered to be a special character inside a
      // regular expression.  Matcher.quoteReplacement() takes care of '\\' and '$'.
      needle = Matcher.quoteReplacement(needle);
      String chars_to_be_escaped = ".|*?+(){}[]^";
  
      for (char c : chars_to_be_escaped.toCharArray()) {
        String regex = "\\" + c;
        String replacement = "\\\\" + c;
        needle = needle.replaceAll(regex, replacement);
      }
  
      String pattern = needle.replaceAll(ANY_MATCHER, "(?:.+)");
      logger.finest("Looking for pattern '" + pattern + "' in '" + haystack + "'");
  
      return haystack.matches(pattern);
    }
docs: Compares haystack and needle taking into the account that the needle may contain any number of
  ANY_MATCHER occurrences, that will be matched to any substring in haystack, i.e. "Show _ANY_
  more..." will match anything like "Show 1 more...", "Show 2 more..." and so on.
  
  @param haystack the text that will be compared, may not contain any ANY_MATCHER occurrence
  @param needle   the text that will be used for comparision, may contain any number of
  ANY_MATCHER occurrences
  @return a boolean indicating whether needle matched haystack.