How to extract OTP

Hi i have the above outlook mail i need to extract Verification Code number. Can anyone please help me in extracting only that Number.

Thanks in advanceotp

Assuming the verification code length is 5.

string strOutlookBodyText = “Body of the Email”

int Index = strOutlookBodyText.IndexOf("Verification Code:")
int iVerificationCode = strOutlookBodyText.SubString(Index + "Verification Code:".Length + 1, 5) 

Regards,
Karthik Byggari

2 Likes

@SIVASHANKAR

Use Matches activity with pattern as (?<=Verification Code:[ ]+)\d+
Just to make sure, once result is retrieved, use trim to remove the whitespace if there any.
This will also work fine even if the verification code length changes.

Hope this is helpful!

1 Like