code: static Matcher removeMatchAnyFollowedByIndexOf(Matcher matcher) {
      if (matcher instanceof ZeroOrMoreMatcher) {
        ZeroOrMoreMatcher zm = matcher.as();
        if (zm.repeated() instanceof AnyMatcher
            && PatternUtils.getPrefix(zm.next()) instanceof IndexOfMatcher) {
          return zm.next();
        }
      }
      return matcher;
    }
docs: Adjacent any matches can be consolidated, e.g., ({@code ".*(.*foo)" => ".*foo"}).