Replace (Effect) — Skript

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

Syntax

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

Description

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

Examples

replace "<item>" in {_msg} with "[%name of player's tool%]"
replace every "&" with "§" in line 1 of targeted block
# Very simple chat censor
on chat:
	replace all "idiot" and "noob" with "****" in the message
	regex replace "(idiot|noob)" with "****" in the message # Regex version using word boundaries for better results
replace all stone and dirt in player's inventory and player's top inventory with diamond

View source