Can someone please help me with the regex patter to fetch the passcode from this email

I want the passocde alone from the below string.

Hi Ragavi, You have requested an email link to sign in to xxx. To finish signing in, enter the provided code. If you did not request this email, please contact your administrator. Enter a code: 037914

Hi @Ragavi_Rajasekar

You can use below regex:

(?<=Enter a code\:\s*)\d+

Your entire Assign syntax will be like:

System.Text.RegularExpressions.Regex.Match(currentMailMessage.Body,"(?<=Enter a code\:\s*)\d+").Value.Trim()

Regards

Hi @Ragavi_Rajasekar

(?<=code:\s?)\d+

Regards,

Hie @Ragavi_Rajasekar follow these steps


to extract the number from the input text
mark this solution if it resolve your query
Cheers Happy Automation. :smile:

Hi @Ragavi_Rajasekar
you can also use this.
pattern :- \d{6}

It worked ! Thank you

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.