code: @Nullable
      public String inverseHighlight(@Nullable String text) {
          if (text == null) {
              return null;
          }
          StringBuilder result = new StringBuilder();
          Matcher matcher = pattern.matcher(text);
          final Pattern spaces = Pattern.compile("\\s");
          int posIn = 0; // current position in input string
  
          // For each highlight:
          while (matcher.find()) {
              String match = matcher.group(1);
              final String before = text.substring(posIn, matcher.start());
              posIn = matcher.end();
              final Matcher spacesBefore = spaces.matcher(before);
  
              if (spacesBefore.matches()) {
  
                  // Append text before, highlighted.
                  result.append(prefixTag);
                  result.append(before);
                  result.append(postfixTag);
              } else {
                  // Append text before, highlighted.
                  result.append(prefixTag);
                  result.append(before);
                  result.append(postfixTag);
              }
  
              // Append matched text, without highlight.
              result.append(match);
          }
          // Append text after, highlighted.
          result.append(prefixTag);
          final String after = text.substring(posIn);
          result.append(after);
          result.append(postfixTag);
          return result.toString().replace(prefixTag + postfixTag, "");
      }
docs: Inverts the highlighting for a given string.
  
  @param text a String matching this highlighter's {@link #pattern}.
  @return the input, with highlights inverted.