Select 1st or 2nd match while using regex based extractor and problem in regex expression for address

Hi @emshihab

You can use Regex to extract the results.

To use Regex, you need 3 things:

  • Sample/s
  • Expected Output
  • Pattern/Information on what is consistent in the text.

As for Q1 - we need a strong pattern as Addresses can change in size and number of rows.

I have a made a quick regex pattern for Q1. Please note this pattern is not robust and will just ignore the first line and start to match from the second line.

Q.2

I have made a regex pattern for Q2. This will match the email addresses in the body of text. Then we just need to collect the second result as you mentioned.

To do this, insert an Assign Activity.
Left of Assign:

YOURSTRING_VARIABLE

Right of Assign:

System.Text.RegularExpressions.Regex.Matches(INPUT_STRING,“REGEXPATTERN”)(1).ToString

Note the brackets at the end of the above syntax:
(0) = 1st result
(1) = 2nd result

I have a made a quick workflow to assist you.
image

Main.xaml (7.1 KB)

Want to learn more? Take a look here:

Hopefully this helps you :blush:

Cheers

Steve