Description

Searches an input string for occurrences of a regular expression and returns all successful matches.



Attributes

Input

  • Input - The string to be searched for matches.

  • Pattern - The regular expression pattern to match.

  • Regex Option - A bitwise combination of the enumeration values that specify options for matching.

Common

  • ContinueOnError - The Boolean value to specify whether to continue executing the next activities even if there is an error thrown on this activity.

Misc

  • DisplayName - Renames the activity.

  • Result - The collection of found matches.


Example

  1. Create a String variable and name it searchFor. For the Default value, write "RPA".
  2. Create an Array of String (String[]) variable and name it result.
  3. Add a Matches activity inside the initial Sequence.
  4. In the Matches Result field, add the result variable.
  5. In the Matches Input field, write the string shown in the screenshot below.
  6. In the Matches Pattern field, add the searchFor variable.
  7. Under the Matches activity, add an If activity. 
  8. In the If Condition field, write result(0).ToString.Equals(searchFor). This would check if the first instance of result is equals with the value of searchFor.
  9. Inside Then, add a Message Box activity.
  10. In the Content field, write "A Match is Found!".
  11. Inside Else, add a Message Box activity.
  12. In the Content field, write "A Match is Not Found."


            The use case should look as the following screenshot:



A Message Box should be prompted upon execution. Since in this example, the value of searchFor is "RPA", the Message Box inside Then should be executed: