Replace Text Action

Description

Finds and replaces each or every occurrence of a text pattern and places the result into a variable.  Regular expressions may be used for added power and flexibility. Used to find and replace a word or phrase inside of a larger piece of text.

Declaration

<AMREPLACE TEXT="test" FIND="test" REPLACE="test" RESULTVARIABLE="text [variable name]" USERE="YES" USECASE="YES" INDEX="6" MAXMATCHES="6" TOTALMATCHESVAR="text [variable name]">

Example

<AMVARIABLE NAME="sourcedata">Automated Workflow Version 5.5 Adds Power, Speed, Flexibility and Intelligence.</AMVARIABLE>
<AMVARIABLE NAME="newdata"></AMVARIABLE>
<AMREPLACE TEXT="%sourcedata%" FIND="Speed" REPLACE="Good Looks" RESULTVARIABLE="newdata">
<AMMESSAGEBOX>BEFORE: %sourcedata%

AFTER: %newdata%</AMMESSAGEBOX>

General Tab Parameters

Text: Specifies target text to be searched.  

Text, Required
MARKUP: TEXT="My Name is Joe"

Find: Specifies the text to search for.

text,Required
MARKUP: FIND="Joe"

Replace with: Specifies the text to replace the found text with.

text,Required
MARKUP: REPLACE="Jim"

Case Sensitive: Specifies whether the search performed should be case sensitive.

Yes/No, Optional (default: No)
MARKUP: USECASE="YES"

Regular Expression: Specifies whether the FIND parameter is a regular expression. If the option is no, the Find parameter contains literal text, if the option is yes, the find parameter contains a regular expression.

Yes/No, Optional (default: No)
MARKUP: USERE="YES"

Populate variable with result: Specifies the variable to receive the new text.

Text [variable name], Required
MARKUP: RESULTVARIABLE="varname"

Advanced Tab Parameters

Starting at the following instance: Specifies target text to be searched.

Number, Optional (default: 1)
MARKUP: INDEX="5"

Maximum Replacements: Specifies the maximum number of replacements that should be made. If 0(default) is specified, all instances of the found text will be replaced.

Text [variable name], Optional (default:0)
MARKUP: MAXMATCHES="6"

Total replacement Count into variable: Specifies the variable to receive the total number of replacements that were made.

Text [variable name], Required
MARKUP: TOTALMATCHESVAR="varname"