@ApiStatus.ScheduledForRemoval(inVersion = "5.0.0")
  @Contract(pure = true)
  @Deprecated
  default @NotNull Component replaceText(final @NotNull Pattern pattern, final @NotNull Function<TextComponent.Builder, @Nullable ComponentLike> replacement, final @NotNull IntFunction2<PatternReplacementResult> fn) {
    return this.replaceText(b -> b.match(pattern).replacement(replacement).condition(fn));
  }
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