# Find

This is a pre-built Action located under the **@Generic Element**. The functionality of this Action in Avo Assure is to check whether the given text exists within the actual string and identify its position. The result is stored in a dynamic variable.

## **Syntax**

**Input Value**: `<actual string>;<string to find>;<wildcard>(Optional)`&#x20;

| Argument                               | Description                                                                                                                                                                                                                                                                                                     |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<actual string><br>(Required)</p>  | Provide the actual string where the search should be performed.                                                                                                                                                                                                                                                 |
| <p>\<string to find><br>(Required)</p> | <p>Provide the string that needs to be searched within the actual string.</p><p><br><strong>Note</strong>: If the third input is a <strong>wildcard</strong>, add the supported wildcard characters (? or *<em>*</em>) immediately after the string to define the search pattern (e.g., string\*/ string?).</p> |
| <p>\<wildcard><br>(Optional)</p>       | Provide the string as wildcard.                                                                                                                                                                                                                                                                                 |

{% hint style="info" %}
**Note**:&#x20;

* This action supports the following wildcard characters:
  * **?** - For single character,
  * **\*** - For single/multiple character.
* If the search needs to use wildcard characters, the third input must be **wildcard** (case insensitive).
* If the wildcard option is specified, the second input must contain the **?** or **\*** character.
* If the wildcard option is not specified, the action performs a normal find operation and does not search using wildcard characters.
  {% endhint %}

**Output Value**: `<Dynamic Variable>;<Dynamic Variable>(Optional)`

| Argument                                     | Description                                                     |
| -------------------------------------------- | --------------------------------------------------------------- |
| <p>\<Dynamic Variable ></p><p>(Required)</p> | This Dynamic Variable save the results **True** or **False**.   |
| <p>\<Dynamic Variable ></p><p>(Optional)</p> | This Dynamic Variable holds the index (position) of the string. |

### **Example 1:** Finding a String

In this example, we explain how to search for an exact string match within a string.

* **Action**: Find
* **Input Value**: I like this post amazing;like
  * The first argument (**I like this post amazing**) specifies the string in which the search will be performed.
  * The second argument (**like**) specifies the word to be searched.
* **Output Value**: {Status};{Position}
  * The first output variable (**{Status}**) stores the execution result with the following possible values:
    * **True**: If the word is found in the string.
    * **False**: If the word is not found in the string.
  * The second output variable (**{Position}**) stores the index position (e.g., **18**) of the matched word.
* **Logical Explanation**: The **Find** action takes the value from the **Input Value** column (**I like this post amazing;like**) and searches for the exact word (**like**) in the given string.\
  First, the action determines whether the specified word exists in the string and stores the result as **True** in the **{Status}** variable. After confirming the match, the action identifies the starting index position of the matched word (**18**) and stores it in the **{Position}** variable.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2F0gWUUOYqvt5oiesWsqHU%2Fimage.png?alt=media&#x26;token=edcdefd8-1e38-4aa8-8b17-d31c3ee8de61" alt=""><figcaption></figcaption></figure>

### Example 2: Finding String Using a Single-Character (?) Wildcard

In this example, we explain how to search for a text pattern where one character may vary.

* **Action**: Find
* **Input Value**: I like this post like amazing;like?;wildcard
  * The first argument (**I like this post like amazing**) specifies the string in which the search will be performed.
  * The second argument (**like?**) specifies the pattern to be searched, where the question mark (?) represents any single character that may appear after “like.”
  * The third argument (**wildcard**) indicates that the search is performed using wildcard characters.
* **Output Value**: {Status};{Position}
  * The first output variable (**{Status}**) stores the execution result with the following possible values:
    * **True**: If a matching pattern is found successfully.
    * **False**: If no match is found in the string.
  * The second output variable (**{position}**) stores the index position (e.g., **18**) of the matched word.
* **Logical Explanation**: The **Find** action takes the value from the **Input Value** column (**I like this post like amazing;like?;wildcard**) and performs a wildcard-based search on the given string.\
  First, the action checks whether the pattern (**like?**) matches any part of the string and stores the result as **True** in the **{Status}** variable. After confirming the match, the action identifies all starting index positions where the pattern occurs (**3** and **18**) and stores them in the **{Position}** dynamic variable.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2Fm92SgvpsX9A84BZdYGBI%2Fimage.png?alt=media&#x26;token=17adb26b-9198-48a8-a39d-ae232660b285" alt=""><figcaption></figcaption></figure>

### **Example 3:** Finding String Using a Multi-Character (\*) Wildcard

In this example, we explain how to search for text patterns using a wildcard.

* **Action**: Find
* **Input Value**: I like this post like amazing;like amazing\*;wildcard
  * The first argument (**I like this post like amazing**) specifies the string in which the search will be performed.
  * The second argument (**like amazing\***) specifies the pattern to be searched, where the asterisk (\*) represents single or more characters that may appear after amazing.
  * The third argument (**wildcard**) indicates that the search is performed using wildcard characters.
* **Output Value**: {Status};{Position}
  * The first output variable stores the execution status with the following possible values:
    * **True**: If the matching pattern is found successfully.
    * **False**: If no match is found in the string.
  * The second output variable stores the starting position of the matched text (e.g., **18**) in the **{Position}** dynamic variable.
* **Logical Explanation**: The **Find** action takes the value from the **Input Value** column (**I like this post like amazing;like amazing\*;wildcard**) and performs a wildcard-based search.\
  First, the action verifies whether the pattern (**like amazing\***) matches any part of the string and stores the result as **True** in the **{Status}** variable. After confirming the match, the action identifies the starting index of the matched text (**18**) and stores it in the **{Position}** variable.

<figure><img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FlyWkbj412dYvtDIT8biD%2Fimage.png?alt=media&#x26;token=0a04ed96-2140-4756-8b15-61627a4a063e" alt=""><figcaption></figcaption></figure>
