Extract Data using Matches Activity

i want to extract the numeric part from the below body of the mail
“Plus Pin Number
The authentication number is 242147 .
Enter the 6 digit authentication number in the input window to log in.
Please do not reply to this e-mail.”

I don’t know to use regex for this , Please Help

Use regex \d{6}.

3 Likes

Welcome @ansuman_giri to the UiPath Community :smiley:

To get the number in your sample text you will need to use a “Matches” activity in UiPath.

As per @Anthony_Humphries’ post, the Pattern will be: \d{6}
You can review the regex solution using the website Regex101.com.

\d{6} will match exactly 6 digits found anywhere in your text. This will work as long as it is the only 6 digit number in the text.

To view the the output from the Matches Activity using the below:
INSERTVARIABLE(0).Groups(1).Tostring

Replace capitals with your variable.

I have made a link on Regex101.com so you can test out the solution.

Check out this Youtube Tutorial which I personally found to be helpful :slight_smile:

I hope this helps.