Find Text Action

Declaration

<AMFINDTEXT TEXT="text" FIND="text" RESULTVARIABLE="text [variable name]" USERE="yes/no" USECASE="yes/no" INDEX="number" FOUNDTEXTVAR="text [variable name]" TOTALMATCHESVAR="text [variable name]">

See Also

Find Text Action-Setting Properties, Get Subtext Action, Pad Text Action, Trim Text Action, Format Date/Time Action

Description

Finds 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.

Practical Usage

Used to locate the a word or phrase inside of a larger piece of text .

Parameters

General Tab

Text

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

Specifies target text to be searched.  

Find

text,Required, Required
MARKUP: FIND="name"

Specifies the text to search for.

Case Sensitive

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

Specifies whether the search performed should be case sensitive.  

Regular Expression

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

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.

Populate Variable with first index

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

Specifies the variable to receive the position of the text if found.

Advanced Tab

Starting at the following instance

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

Specifies target text to be searched.  

Total Find Count into Variable

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

Specifies the variable to receive the total instances found.

Populate Variable with found text

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

Specifies the variable to receive the text that was found. This parameter is useful if a regular expression was used for the find text.

Notes

Using Variables

All variables must be created before they can be used. This is done using the Create Variable <AMVARIABLE> action. Once created, variables can be set using the Set Variable <AMSET> action, or by certain actions that support populating variables. To get data out of the variables, in any action parameter, simply surround the variable name with percentage % signs (e.g. %varname%). Remember not to use percentage signs when specifying the name of a variable to populate, percentage signs are only needed to get data out.

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMVARIABLE NAME="index"></AMVARIABLE>
<AMFINDTEXT TEXT="Finds 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." FIND="occurrence" RESULTVARIABLE="index">
<AMMESSAGEBOX>The word 'occurrence' was found at position: %index%</AMMESSAGEBOX>