FANDOM


Replaces text in a container with other text.

Syntax:

replace <oldString> with <newString> in <container>

Examples:

replace "A" with "N" in thisVariable -- changes all As to Ns
replace return with empty in field 1 -- runs lines together
replace somethingOld with "\" in it
replace ".com" with somethingNew in URL "file:stuff.txt"

Use the replace command to replace all instances of one string with another string.

The replace command is faster than the replaceText function, but does not support regular expressions: you can replace only an exact string of text.

You can use the replace command on a field, but doing so removes any formatting (fonts, styles, colors, and sizes) in the field. To preserve existing styling in fields use the replace in field command.

Parameters:

  • oldString (string): Any expression that evaluates to a string, and specifies the text toreplace.
  • newString (string): Any expression that evaluates to a string, and specifies the text toreplace the oldString with.
  • container: A field, button, or variable, or the message box.

See also: replace in field (command), replaceText (function), field (object),

Community content is available under CC-BY-SA unless otherwise noted.