$replaceTextWithRegex
$replaceTextWithRegex
will replace specific segments of text.
Usage
$replaceTextWithRegex[text;reg;flags;newText]
Parameters
Field | Type | Description | Required |
---|---|---|---|
text | string | Text you want to modify. | true |
reg | string | The regex that will be replaced. | true |
flags | string | Flags. | true |
newText | string | The text that will replace reg . | false |
Flags
Flags | |
---|---|
g | Replace all matches (case-sensitive) |
m | Multiline matching |
i | Replace all matches (case-insensitive) |
Example(s)
This will replace more
with less
:
1client.command({2 name: "replaceTextWithRegex",3 code: `4 $replaceTextWithRegex[This function is more complicated than it looks.;more;g;less]5 `6});
Advanced Example
This will replace less
with more
:
1client.command({2 name: "replaceTextWithRegex",3 code: `4 $replaceTextWithRegex[This function is more simple than it looks.;less;g;more]5 `6});