[UIPath] Extract value inside parenthesis using regex patterns

I have a scenario here where I wanted to extract a value inside a parentheses. Using the Matches activity in UIPath, I'm able to do just that. Here's how: Look for Matches activity and drop it on your workspace. I added a Message Box below to see the output.

On the Properties panel, fill in the Input (string) and Pattern (regex). For the Result, create a new variable with data type IEnumerable<Match>. This will hold all the matches found in your string input.

Input: "I want to extract (value) here"
Pattern: "\((.*?)\)"
Result: RegexMatch (var with DataType IEnumerable<Match>)

Since I know I'm only looking for 1 match, I don't need to loop through the result array. I can simply access the first value by checking index 0, hence RegexMatch(0).ToString in the Message Box.

This will output the following:

Knowledge of regular expressions is needed here, thankfully there's Google! If you want to validate your regex before running the activity, you can use this link: http://regexstorm.net/tester