Replace (Effect) — Skript

Addon: Skript · Category: Effect · Since: 2.0, 2.2-dev24 (replace in multiple strings and replace items in inventory), 2.5 (replace first, case sensitivity)

Syntax

replace [all|every|[the] first] %strings% in %strings% with %string% [case:with case sensitivity]

Description

Replaces all occurrences of a given text with another text. Please note that you can only change variables and a few expressions, e.g. a <a href='./expressions.html#ExprMessage'>message</a> or a line of a sign.

Examples

replace "<item>" in {textvar} with "%item%"
replace every "&" with "§" in line 1
# The following acts as a simple chat censor, but it will e.g. censor mass, hassle, assassin, etc. as well:
on chat:
	replace all "kys", "idiot" and "noob" with "****" in the message
 
replace all stone and dirt in player's inventory and player's top inventory with diamond

View source