Skip to main content

Replace Text

Command description

Replaces text, numbers, phone numbers, email addresses, ID numbers, or custom regular-expression matches and saves the result as a new variable.

Command Input Parameters

input parametersInput parameter typeDescription
Content SourceanySource content. List items are joined with newline characters; other values are converted to strings before replacement.
Replacement MethodenumReplace Text, Replace Number, Replace Phone Number, Replace Email, Replace ID Number, Custom Regex
Text to ReplaceanyPlain text or regular expression to match. Required when Replacement Method is Replace Text or Custom Regex
Replace First Match OnlyboolWhether to replace only the first matching content
Ignore CaseboolWhether to ignore English case when matching
ReplacementanyNew content used to replace the matching content. It can be empty and will be converted into a string at runtime.

Command Output Parameters

Output parametersOutput parameter typeDescription
Replacement ResultstrReplaced text

Note

In Replace Number mode, signed integers and decimals are replaced, including numbers adjacent to letters. For example, Order A1024 amount CNY 29.8 replaces 1024 and 29.8.

Replace Text treats Text to Replace as literal text. Custom Regex treats it as a Python regular expression.

JSON workflow example

[
{
"ins": "Replace Text",
"in": {
"Content Source": "'Order A1024, amount 29.8'",
"Replacement Method": "'Replace Number'",
"Replace First Match Only": "False",
"Ignore Case": "False",
"Replacement": "'*'"
},
"out": {
"Replacement Result": "replaceText"
}
}
]

AI Workflow Generation Notes

  • Use Custom Regex only when regular-expression matching is required.