@Override
  default @NotNull Component asComponent() {
    return this;
  }
Finds and replaces text using a regex pattern.

<p>Utilises an {@link IntFunction2} to determine if each instance should be replaced.</p>

@param pattern a regex pattern
@param replacement a function to replace the first match
@param fn a function of (index, replaced) used to determine if matches should be replaced, where "replaced" is the number of successful replacements
@return a modified copy of this component
@since 4.0.0
@deprecated for removal since 4.2.0, use {@link #replaceText(Consumer)} or {@link #replaceText(TextReplacementConfig)} instead.
api/src/main/java/net/kyori/adventure/text/Component.java