Skip to content
Math & Text replaceRegex

$replaceRegex — Replaces text matching a regular expression.

Replaces text matching a regular expression.

Syntax

$replaceRegex[text;regex;flags;replacement;(amount)]

Parameters

  • text (text, required) — The text.
  • regex (text, required) — The pattern.
  • flags (text, required) — Flags: g, i, m, s, u.
  • replacement (text, required) — Replacement; $1 inserts a group.
  • amount (number, optional) — Maximum number of replacements.

Return Value

  • string.

Usage

$replaceRegex[a1b2;[0-9];g;#] → "a#b#"

Example

$sendMessage[$replaceRegex[a1b2;[0-9];g;#]]

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.