code: @Override
      public int replace(Replaceable text,
                         int start,
                         int limit,
                         int[] cursor) {
  
          int outLen = 0;
  
          // Copy segment with out-of-band data
          int dest = limit;
          // If there was no match, that means that a quantifier
          // matched zero-length.  E.g., x (a)* y matched "xy".
          if (matchStart >= 0) {
              if (matchStart != matchLimit) {
                  text.copy(matchStart, matchLimit, dest);
                  outLen = matchLimit - matchStart;
              }
          }
  
          text.replace(start, limit, ""); // delete original text
  
          return outLen;
      }
docs: UnicodeReplacer API