Forum Discussion

royd's avatar
royd
Regular Contributor
8 years ago
Solved

Regular Expression to extract a 'word' from string. Need help.

I am trying to extract success code from email message. I was able to do so with “aqString.SubString” method, thanks to Shankar R. I have been practicing Regular Expression and wanted to attempt extracting the access code using Regular Expression. The security code email message contains the following message:

 

Your AMG - Facility forms access code is 22RP3DPM. You will receive a link to your forms using your primary email address. You will need this access code to use the forms link. Further instructions will be available after using the access code to access the forms.

 

 

With Regular Expression, I was able to isolate the access code, this is what I came up with:

   \b[0-9A-Z]{8}\b

 

I can access the entire message with following:

 

let msgText = page.FindChild(“idStr”, “msg_panel”, 10).contentText;

How can I isolate the access code using Regular Expression? I really appreciate any help I can get.

 

Thanks

 

Dave