Match
AutomatR.DefaultActivities.GenericValue.Match
The "Match" activity in AutomatR, categorized under String, searches an input string for all instances of a regular expression and retrieves all successful matches. This activity is useful when you need to extract specific patterns from a string based on a regular expression.
Properties
Name | Description |
---|---|
Input | |
Input | The string to be searched for matches. String variables containing the input string. |
Pattern | The matching regular expression pattern. String variables containing the regex pattern. |
RegexOptions | Select a bitwise combination of the enumeration values that specify options for matching from the dropdown. |
Misc | |
Display Name | Provides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variable or argument containing the desired display name. |
Optional | |
Delay | Specifies the amount of time (in seconds) to wait before executing the "Match" activity. Useful for handling synchronization issues. Integer variables containing the delay duration. Example: If the wait time is 1000 milliseconds or 1 sec, i.e., 1. |
Output | |
Result | It stores the result with a match variable, which can be used in other subsequent activities. Variables of type System.Text.RegularExpressions.Match to store the match result. |
How to use:
- Drag and drop the "Match" activity onto the workflow.
- Configure the properties by specifying the input string, regex pattern, and regex options.
- Optionally, configure the delay based on your requirements.
- Execute the workflow to search for matches in the input string based on the specified regex pattern.
Example: Consider an example where the "Match" activity is used to extract the domain from an email address:
Match:
Input: "user@example.com"
Pattern: "@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})"
RegexOptions: IgnoreCase
Result: extractedDomain
In this example, the activity searches for the domain pattern within the input email address "user@example.com". The result, which includes the matched domain, is stored in the System.Text.RegularExpressions.Match
variable "extractedDomain" for further handling in the workflow.