code: public String apply(String word) {
      Matcher matcher = pattern.matcher(word);
      if (!matcher.matches()) { throw new IllegalArgumentException("Word '" + word + "' does not match regex: "
          + pattern.pattern()); }
      return replace(matcher);
    }
docs: {@inheritDoc}