Skip to main content

SUBSTITUTE

Use the SUBSTITUTE function to replace specific text in a text value.

Use

SUBSTITUTE( text, old_text, new_text [, instance_num] )
Substitutes new text for old text in a text value.

ParameterRequiredDescription
textYesthe text in which to substitute characters
old_textYesthe text to replace
new_textYesthe new text to replace old_text with
instance_numNospecifies which occurrence of old_text to replace with new_text (default all)

ReturnsText

Examples

Updating Domain Names in Email Strings

You can use SUBSTITUTE in an Input Mapping formula to ensure that email addresses provided in a trigger form are automatically updated to a new corporate domain before being passed to a reviewer.

  • Scenario: A company has rebranded from "AcmeCorp" to "AcmeGlobal," and you want to update a user's entered email address variable.
  • Formula: SUBSTITUTE(@Trigger.out.UserEmail, "acmecorp.com", "acmeglobal.com")
  • Logic: This formula scans the text in UserEmail, finds every instance of "acmecorp.com," and replaces it with "acmeglobal.com".
  • Result: If the input was "j.smith@acmecorp.com," the resulting text will be "j.smith@acmeglobal.com."

Targeted Character Replacement (Using Instance_Num)

You can use the optional instance_num parameter to replace only a specific occurrence of a character. This is helpful for standardizing custom reference codes that may contain repeated delimiters.

  • Scenario: A "Project Code" is submitted as "2024-DEV-ALPHA-01." For a specific database integration, you need to change only the second hyphen to an underscore while leaving the others intact.
  • Formula: SUBSTITUTE($ProjectCode, "-", "_", 2)
  • Logic: By setting the instance_num to 2, the function ignores the first, third, and fourth hyphens and only substitutes the second one.
  • Result: The code transforms from "2024-DEV-ALPHA-01" to "2024-DEV_ALPHA-01."