Replace Text

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. Generally 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]">

See Also: Find Text, Format Date/Time, Get Subtext, Insert Text, Pad Text, Trim Text

General Tab

Property

Type

Required

Default

Markup

Description

Text

Text

Yes

(Empty)

TEXT="My Name is Joe"

The target text to be searched.

Find

Text

Yes

(Empty)

FIND="Joe"

The text to search for.

Replace With

Text

Yes

(Empty)

REPLACE="Jim"

The text to replace the found text with.

Case Sensitive

Yes/No

No

No

USECASE="YES"

If set to YES, specifies that the search performed should be case sensitive. This parameter is set to NO by default.

Regular Expression

Yes/No

No

No

USECASE="YES"

If set to YES, specifies that the FIND parameter contains a regular expression. If set to NO (default), the Find parameter contains literal text.

Populate variable with result

Text

Yes

(Empty)

RESULTVARIABLE="varname"

The name of the variable to receive the new text after replacement.

Advanced Tab

Property

Type

Required

Default

Markup

Description

Starting at the following instance

Number

No

1

INDEX="5"

Specifies at what instance text replacement should be applied.

Maximum replacements

Number

No

0

MAXMATCHES="6"

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

Total replacement count into variable

Text

No

(Empty)

TOTALMATCHESVAR="varname"

The name of the variable to receive the total number of replacements that were made.