# Compare Text

> `UiPath.Testing.Activities.CompareText`

`UiPath.Testing.Activities.CompareText`

## Description

Verifies if two texts are equivalent, using multiple comparison options, including the following comparison types:

* Comparing words.
* Comparing lines.
* Comparing characters as `char` variables.

The **Compare Text** activity also allows you to exclude specific sections from the comparison process, using predefined rules of type regular expression (regex) and wildcard.

## Project compatibility

**Windows-Legacy | Windows | Cross-platform**

## Configuration

#### Designer panel

* **Baseline Text** - The base text that is used as a reference for comparison.
* **Target Text** - The text that is compared against the base document.
* **Output File Path** - The folder path where the output file will be saved.
* **Interpret differences with Autopilot**: Perform the verification using the AI capabilities offered by Autopilot to obtain a semantic interpretation of the differences. Enabling the **Interpret differences with Autopilot** option generates an additional output named **Semantic Differences**, and removes the **Comparison Type** property.
  :::note
  Enabling the **Interpret differences with Autopilot** option consumes one of the following, depending on the licensing plan you're enrolled in:
  * For the Flex licensing plan, the **Interpret differences with
  Autopilot** option consumes one AI unit for each activity execution
  * For the Unified Pricing plan, the **Interpret differences with
  Autopilot** option consumes one Platform unit for each activity execution. For more information on consumption, visit [About the Testing activity package](https://docs.uipath.com/activities/other/latest/workflow/about-the-testing-activities-pack).
  :::

#### Properties panel

**Input**
* **Comparison Type** - The type of comparison to use when comparing text. This property is available only if the **Interpret differences with Autopilot** option is disabled. The following options are available:
  + **Line** - Compares the texts line by line.
  + **Word** - Compares the texts word by word.
  + **Character** - Compares the texts character by character.
* **Rules** - The list of rules that you want to use to exclude certain sections from comparison. Input the comparison rule output variables you created using the [Create Comparison Rule](https://docs.uipath.com/activities/other/latest/workflow/create-comparison-rule) activity. Select **Open Collection Builder** and add the rules as entries.
* **ContinueOnFailure** - Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (`True`, `False`). The default value is `False`. As a result, if the field is blank and an error is thrown, the execution stops. If the value is set to `True`, the execution of the project continues regardless of any error.

**Output**
* **Differences** - Represents a list of differences resulted from the comparison process. Each **Difference** comprises an Operation, which signals the type of modification (possible values are **Equal**, **Inserted**, or **Deleted**) and a **Text** element that highlights the specific content correlated with the operation.
* **Result** - Defines the final result. It displays **True** if the verification succeeds and the texts are equivalent. It displays **False** if the verification does not succeed, indicating differences between the texts.
* **Semantic Differences** - This property is only available if you enabled the **Interpret differences with Autopilot** option. Semantic differences represent the results of the text verification process achieved using the AI capabilities of Autopilot.
